On Tue, Sep 10, 2013 at 4:31 PM, Riccardo Mottola <[email protected]> wrote: > Hi, > > > Wolfgang Lux wrote: >> >> Riccardo Mottola wrote: >> >>> do you see anything wrong with this macro? >>> >>> #define S2AS(_x) ( (_x) ? [[[NSAttributedString alloc] initWithString: >>> (_x)] autorelease] : nil )
unrelated to the warnings, but one issue with this macro is that it evaluate _x twice, should x contain side effects or message sends, message sends will be invoked twice, side effects applied twice e.g. S2AS(foo[i++]) would increment i twice generally this is something to be avoided, one potential way to avoid it would be by putting categories on the class of _x e.g. -[_xclass attributedString], message to nil would return nil and so there should be no need to evaluate _x multiple times anymore. _______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
