gap-dev-discuss
[Top][All Lists]
Advanced

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

Re: [Gap-dev-discuss] Cythiune : fix badly written macros causing nasty


From: Philippe Roussel
Subject: Re: [Gap-dev-discuss] Cythiune : fix badly written macros causing nasty crashes
Date: Thu, 17 May 2012 15:04:11 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Le 17/05/2012 14:51, Riccardo Mottola a écrit :
> Hi,
> 
> I think there is no problem releasing a nil object (small speed penalty
> which, seen  the size of Cynthiune is unimportant.
> 
> I don't like these macros, but I don0't see whileyou rewrite them in
> such a funny way.
> 
> Stuff like that is written in base is:
> 
> #define TEST_RELEASE(object)    ({\
> id __object = (object); if (__object != nil) [__object release]; })
> #endif
> 
> #define ASSIGN(object,value)    ({\
>   id __object = object; \
>   object = [(value) retain]; \
>   [__object release]; \
> })
> #endif

And yes, this version is better because the macro argument is only
evaluated once.

Philippe



reply via email to

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