View Single Post
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#30
Originally Posted by lma View Post
Not really. Both languages were independent attempts to add object oriented features to C, and they are very different. Language purists seem to thing Objective C, being smaltalk-like in its OO, is much better at it, though in real life it's almost never used outside of NeXTSTEP and derivatives so it's a bit of a moot point.



Historically the C++ ABI has been a mess and it was very difficult to link C++ code with anything. Things are better now, and there's even an "Objective C++" but don't try mixing C++ and Objective C classes, namespaces etc unless you like living in interesting times. Mixing either language with C is much more straightforward of course.
The documentation and code examples seem to say otherwise. A typical Objective C code file has a .m extension. It seems that Objective C that instantiates C++ classes get a .mm file extension. Maybe that's the trigger for fixing namespaces. I have these examples running on my touch and the .h/.cpp files do contain actual C++ classes. A language isn't a compiler or a linker. I wonder if I'm breaking my iPhone Developer License just talking about this. I hope not 'cause I just became comfortable with Objective-C memory management.

EDIT:

Yes, not to contradict myself too much further, you are right, C++ is not a subset of Objective-C.
__________________
N9: Go white or go home

Last edited by daperl; 2009-06-07 at 16:04.