On 7 Jul 2011, at 20:52, Ondřej Hošek wrote: > They remain untouched by ARC. ObjC pointers are detected using > semantic analysis -- a heuristic along the lines of "oh, an asterisk, > I'm taking over" would break everything (including the "strict > superset of C" philosophy).
C or C++. ARC works extremely nicely with Objective-C++. C++ structures can contain Objective-C pointers, but then they become non-POD types and have a destructor added that releases the Objective-C ivars. C++ templates can take Objective-C types and will have the retain / release calls added automatically. This means that you can write things like: std::map<int, __weak NSString*> foo; The variable foo will then be a(n ordered) map from integers to NSStrings. If you do: id a = foo[12]; Then a will be nil if the string that was inserted into the collection has been deallocated before this line is reached. This makes Objective-C++ a lot nicer to work with - you don't need to worry about memory management for Objective-C objects, it happens automatically even when you store them in C++ variables. You don't have to think about copy constructors calling retain and so on, all of this Just Works™. David -- Sent from my STANTEC-ZEBRA _______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
