On 10 Aug 2015, at 13:59, Dave <d...@looktowindward.com> wrote: > Has anyone come up with a way of having the source code support both ARC and > Manual Memory Management without using #IFDEF or #IF ? > > I’ve never understood why the compiler doesn’t just ignore code like: > > [super dealloc]; > > [MyObj release]; > > If it’s being compiled for ARC, that way both could be compiled with the same > source code or is there more to it?
Because then there'd be no point in using ARC. ARC is supposed to take the hassle of manual memory management off your hands, and automate it to avoid mistakes. It is also less misleading if the retain/release lines aren't in your code, compared to having them in there but being no-ops. It also inter-operates seamlessly with non-ARC code (as it generates the retains and releases for you, it is equivalent to manually managed code to any non-ARC caller). Is there a reason why you can't add -fobjc-arc to the compiler flags for the files that use ARC in your non-ARC projects? That way, you can bit by bit move your project to ARC, yet don't have to manually manage the new code. The only reason I'm aware of is if you need to port to a platform that doesn't support libArclite (like really old Mac/iOS versions). Cheers, -- Uli Kusterer "The Witnesses of TeachtText are everywhere..." _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com