Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad kCFTaggedObjectID_Integer definition ? #15

Open
tshirtman opened this issue Dec 16, 2014 · 2 comments
Open

bad kCFTaggedObjectID_Integer definition ? #15

tshirtman opened this issue Dec 16, 2014 · 2 comments

Comments

@tshirtman
Copy link
Member

tshirtman commented Dec 16, 2014

https://github.com/kivy/pyobjus/blob/master/pyobjus/pyobjus_conversions.pxi#L188

defines it as (3 << 1) + 1

while all references i seem to find defines it as (1 << 1) + 1

http://www.crest.iu.edu/projects/conceptcpp/docs/html-ext/CGObjCMac_8cpp_source.html#l01623
http://bou.io/talks/TaggedPointersTests.html#4

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/7064670-bad-kcftaggedobjectid_integer-definition?utm_campaign=plugin&utm_content=tracker%2F77137&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F77137&utm_medium=issues&utm_source=github).
@tshirtman
Copy link
Member Author

Apparently while this value is indeed (1 << 1) + 1 on 10.7.5, it changed to (3 << 1) + 1 in 10.8.5, so the value probably needs to be imported from the right place at compile time.

@tshirtman
Copy link
Member Author

After reading on tagged pointers, it seems any info about them−aside the general idea−is fragile and undocumented, because intended to be private, so I'm wondering if the solution wouldn't be just to instanciate an NSNumber at import time, with a very low value (i guess 1 would do), and take the kCFTaggedObjectID_Integer value from the LSB of the returned pointer. Since there are a few other types that can be represented as tagget pointers, (a potential list of which can be found here http://stackoverflow.com/questions/20362406/tagged-pointers-in-objective-c), we could instanciate values of them that should fit and check for their last bit to get the correct class, at runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant