Ah, I see how this can be a problem. In this case, if I remember correctly, small objects have the least significant bit set to 1. Checking for that bit should be sufficient:
if ((0x01 & cf)) return _kCFRuntimeNotATypeID; On Fri, Jun 7, 2013 at 11:02 AM, Luboš Doležel <[email protected]> wrote: > I see. The problem is in CFGetTypeID() where the pointer is accessed in > an unsafe way (as you noted yourself in the code). I haven't given in much > thought yet, though... > > Lubos > > Dne 7. června 2013 17:41:15 Stefan Bidi ** napsal: > > The CF_IS_OBJC() macro will correctly identify small objects. The > function objc_getClass() will return a valid ObjC class that isn't > toll-free bridged and so CF_IS_OBJC() should return true. This should work. > > > On Fri, Jun 7, 2013 at 10:29 AM, Luboš Doležel <[email protected]> wrote: > >> Hi, >> >> for toll-free bridging in CoreBase, I need a way to detect whether the >> incoming pointer is a small object encoded in a pointer and act accordingly >> (treat it as an ObjC object and avoid reading it). >> >> What is the correct approach? >> >> Thanks! >> -- >> Luboš Doležel >> >> >> ______________________________**_________________ >> Gnustep-dev mailing list >> [email protected] >> https://lists.gnu.org/mailman/**listinfo/gnustep-dev<https://lists.gnu.org/mailman/listinfo/gnustep-dev> >> > >
_______________________________________________ Gnustep-dev mailing list [email protected] https://lists.gnu.org/mailman/listinfo/gnustep-dev
