Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-26 Thread Uli Kusterer
On 26.06.2012, at 03:20, Graham Cox wrote: On 26/06/2012, at 7:42 AM, Greg Parker wrote: We recommend each file be written for either one or the other, with no attempt to be ARC-agnostic. Does this imply that ARC can be adopted gradually? Yes. ARC (effectively) generates the

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-26 Thread Jean-Daniel Dupas
Le 26 juin 2012 à 11:24, Uli Kusterer a écrit : On 26.06.2012, at 03:20, Graham Cox wrote: On 26/06/2012, at 7:42 AM, Greg Parker wrote: We recommend each file be written for either one or the other, with no attempt to be ARC-agnostic. Does this imply that ARC can be adopted gradually?

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Uli Kusterer
On 24.06.2012, at 03:41, Dave DeLong wrote: #define DD_RETAIN(_o) (_o) #define DD_RELEASE(_o) #define DD_AUTORELEASE(_o) (_o) IIRC GNUstep already has standard-defined RETAIN() macros etc. (When they added their garbage collector, way before Apple made their attempt at one) Might be worth

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Uli Kusterer
On 24.06.2012, at 05:55, Jerry Krinock wrote: Why didn't Apple do the same thing for ARC? Because the whole point of ARC is that you don't have to write retain/release calls, and thus can't make mistakes in them. Since, once compiled, ARC code is pretty much identical to manually managed code

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Greg Parker
On Jun 23, 2012, at 8:55 PM, Jerry Krinock je...@ieee.org wrote: But now I wonder why Apple did not do this, as they did with Garbage Collection. Methods -retain, -release, and -autorelease are no-ops when GC is on. Why didn't Apple do the same thing for ARC? Objective-C garbage

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Graham Cox
On 26/06/2012, at 7:42 AM, Greg Parker wrote: We recommend each file be written for either one or the other, with no attempt to be ARC-agnostic. Does this imply that ARC can be adopted gradually? For example, I have a large project that uses manual memory management. If I add a new class

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Dave DeLong
Yes, you can do this, because ARC is a compile-time option and files are compiled individually. To compile with ARC, you'll need to use the -fobjc-arc flag. Cheers, Dave Sent from Jane On Jun 25, 2012, at 6:20 PM, Graham Cox graham@bigpond.com wrote: On 26/06/2012, at 7:42 AM, Greg

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-24 Thread Jean-Daniel Dupas
Le 24 juin 2012 à 07:18, Roland King a écrit : On Jun 24, 2012, at 12:25 PM, Graham Cox wrote: On 24/06/2012, at 1:55 PM, Jerry Krinock wrote: Why didn't Apple do the same thing for ARC? Because ARC is a compiler technology that inserts -retain, -release automatically and

Why do we use -fobjc-arc instead of removing code with #define?

2012-06-23 Thread Jerry Krinock
I'm curious as to why, when using non-ARC code, the recommendation is to opt out the file with -fobjc-arc. How about doing something like this… #ifndef HEY_ARC_IS_IN_USE [foo retain] ; #endif This way the file is fixed once and for all, and I don't have to be setting -fobjc-arc every time

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-23 Thread Dave DeLong
Yep, you can do this. The #if you're looking for is: #if __has_feature(objc_arc) ... #endif You can just scatter that everywhere in code, or you could do something like this: #if __has_feature(objc_arc) #define DD_RETAIN(_o) (_o) #define DD_RELEASE(_o) #define DD_AUTORELEASE(_o) (_o)

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-23 Thread Jerry Krinock
On 2012 Jun 23, at 18:41, Dave DeLong wrote: Yep, you can do this… Very good, Dave. I'm doing it. But now I wonder why Apple did not do this, as they did with Garbage Collection. Methods -retain, -release, and -autorelease are no-ops when GC is on. Why didn't Apple do the same thing for

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-23 Thread Graham Cox
On 24/06/2012, at 1:55 PM, Jerry Krinock wrote: Why didn't Apple do the same thing for ARC? Because ARC is a compiler technology that inserts -retain, -release automatically and silently into your code as it is compiled. The methods have to be there in order for memory management to work at

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-23 Thread Roland King
On Jun 24, 2012, at 12:25 PM, Graham Cox wrote: On 24/06/2012, at 1:55 PM, Jerry Krinock wrote: Why didn't Apple do the same thing for ARC? Because ARC is a compiler technology that inserts -retain, -release automatically and silently into your code as it is compiled. The methods