discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: GNUstep.h (was: Re: Setter Gettor method style)


From: Bissell, Tim
Subject: RE: GNUstep.h (was: Re: Setter Gettor method style)
Date: Thu, 8 Aug 2002 10:20:54 +0100

> From: Nicola Pero [mailto:nicola@brainstorm.co.uk]

> By the way, it looks like it should be 
> 
> #define TEST_AUTORELEASE(object) ({ object != nil ? [object autorelease] :
nil })

As the ?: ternary operator is already an expression,

#define TEST_AUTORELEASE(object) \
       ( object != nil ? [object autorelease] : nil )

would do, but surely to avoid the possible side-effects
in the macro argument(e.g.):

TEST_AUTORELEASE([foo gimmeAnotherObject])

#define TEST_AUTORELEASE(object) \
       ({ id o = (object); (o != nil) ? [o autorelease] : nil; })

would be safest of all

[ Help!  I'm turning into a language lawyer! ]


----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.
----------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]