Xref: utzoo comp.std.c:380 comp.lang.c:12622 Path: 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 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)