Is an object in objective-c EVER created without going through alloc?
Posted
by Jared P
on Stack Overflow
See other posts from Stack Overflow
or by Jared P
Published on 2010-04-18T16:11:23Z
Indexed on
2010/04/18
16:13 UTC
Read the original article
Hit count: 409
objective-c
|iphone
Hi,
I know that there are functions in the objective-c runtime that allow you to create objects directly, such as class_createInstance. What I would like to know is if anything actually uses these functions other than the root classes' (NSObject) alloc method. I think things like KVC bindings might, but those aren't present on the iPhone OS (to my knowledge, correct me if I'm wrong), so is there anything that would do this?
In case you're wondering/it matters, I'm looking to allocate the size of an instance in a way that circumvents the objc runtime by declaring no ivars on a class, but overriding the +alloc method and calling class_createInstance(self, numberofbytesofmyivars).
Thanks
© Stack Overflow or respective owner