🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5334

Re: Variable length arg lists for macros

#5334
From: David DiGiacomo
Date: Thu, 15 Sep 1988 23:23
17 lines
830 bytes
In article <13573@mimsy.UUCP> chris@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)
Technical Details
Message-ID: <68623@sun.uucp>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!seismo!sundc!pitstop!sun!david
References: <438@ucsvc.unimelb.edu.au> <1036@cbnews.ATT.COM> <228@itivax.UUCP> <362@island.uu.net> <13573@mimsy.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!seismo!sundc!pitstop!sun!david
From: david@sun.uucp (David DiGiacomo)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: Variable length arg lists for macros
Message-ID: <68623@sun.uucp>
Date: 15 Sep 88 23:23:15 GMT
References: <438@ucsvc.unimelb.edu.au> <1036@cbnews.ATT.COM> <228@itivax.UUCP> <362@island.uu.net> <13573@mimsy.UUCP>
Organization: Sun Microsystems, Inc. - Mtn View, CA
Lines: 17