> On 10 Aug 2015, at 19:59, Dave <d...@looktowindward.com> wrote:
> 
> Hi,
> 
> 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?
> 
> 

What’s the use case here? ARC and MMR are completely interoperable. When would 
you need to compile a file under both? If it’s legacy and needs to build under 
a really old compiler then you don’t convert it to ARC and you always compile 
it non-ARC, once it’s converted you always compile it with ARC no matter what 
you’re doing for other files in the project. 

As for why - the rationale is in section 7.1.1 of the arc spec 
http://clang.llvm.org/docs/AutomaticReferenceCounting.html 
<http://clang.llvm.org/docs/AutomaticReferenceCounting.html> and the following 
section for dealloc. It’s specified that code is ill-formed if it includes any 
of those and so the compiler has to follow the spec to it can’t ignore them. 
You may or may not agree with the rationale, but at least the specifiers of the 
language did write down why it’s that way. 



_______________________________________________

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

Reply via email to