Marc Brünink schrieb:
> Hi all,
> 
> This Code does not work on Solaris 10 x86:
> #define MIN(a,b) \
>       ({typeof(a) _MIN_a = (a); typeof(b) _MIN_b = (b);  \
>         _MIN_a < _MIN_b ? _MIN_a : _MIN_b; })
> 
> But this one does:
> #define MIN(a,b) ( a < b ? a : b)
> 
> So why the heck do we use all this typeof stuff?

To insure that a and b are not evaluated more than once when the macro
is expanded:

val = MIN(i++,--j); /* Or insert any method invokation that changes
state.  */

Try using __typeof__ which I believe may be more portable.

Cheers,
David



_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to