Variable length arg lists for macros
    David DiGiacomo 
    david at sun.uucp
       
    Fri Sep 16 09:23:15 AEST 1988
    
    
  
In article <13573 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>or, if you need {}s,
>
>	#define	MAC() do { mac_statements } while (0)
That's nice, but lint churlishly complains about "constant in conditional
context".  To avoid this, use:
#ifdef lint
int _ZERO_;
#else
#define _ZERO_ 0
#endif
#define _STMT(op)	do { op } while (_ZERO_)
#define	MAC()		_STMT(mac_statements)
    
    
More information about the Comp.std.c
mailing list