On Sun, Oct 11, 2009 at 4:08 PM, Clark Cox <clarkc...@gmail.com> wrote: > On Sun, Oct 11, 2009 at 1:06 PM, Ben Haller > <bhcocoa...@sticksoftware.com> wrote: >> On 11-Oct-09, at 3:52 PM, Kyle Sluder wrote: >> >>> On Oct 11, 2009, at 12:44 PM, Ben Haller <bhcocoa...@sticksoftware.com> >>> wrote: >>> >>>> OK, makes sense. My only question: what's the best way to switch at >>>> compile time based on whether GC is enabled for the build? I.e. what do I >>>> #if or #ifdef? I could do it based on the arch or the SDK, but if there's >>>> a >>>> flag specifically for GC I'd rather use that... >>> >>> The purpose of GC-supported rather than GC-required is that you don't do >>> this. Rather, you write your code so that it works in either retain-release >>> or garbage collected environments. >> >> Yes, but my code also needs to compile as GC-unsupported against the 10.4 >> SDK, where any GC-specific calls that I might need to make will not compile. >> Am I missing something? > > There aren't any "GC-specific calls" to make.
Every time you assign a value to an instance variable, this passes through a write barrier, which is a fancy way of saying that the compiler generates code which calls a garbage collection function to perform the assignment, rather than performing it directly. Now, I *think* that 10.4 actually has stub versions of all these calls which work correctly for the non-GC case which will always be found on 10.4, but it's manifestly not the case that there aren't any GC-specific calls to make. Any code compiled with GC enabled will be full of GC-specific calls, it's just that very few of them are explicit. Mike _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com