On Fri, Jan 1, 2010 at 10:01 PM, aaron smith <beingthexemplaryli...@gmail.com> wrote: > Hey All, quick question, > > I wrote a simple macro to make memory cleanup a bit easier, but I ran > into something I'm not sure why is happening.. > > here's the macro: > > NS_INLINE void GDRelease(id obj) { > [obj release]; > obj=nil; > }
That's not a macro, it's an inlined function. The reason the nil doesn't work is for the same reason it wouldn't work in any other function. Namely, you're only modifying the argument (which is a copy) and not the original variable. If you really wanted a macro, it would look like this: #define GDRelease(x) do { [(x) release]; (x) = nil; } while (0) _______________________________________________ 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