From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Sat, 12 Nov 2005 08:17:45 -0500 From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Subject: Re: [9fans] USED() macro In-Reply-To: <0127f0e483812bde9207dcadeb8a009f@terzarima.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1131789636.7582.55.camel@localhost.localdomain> <0127f0e483812bde9207dcadeb8a009f@terzarima.net> Topicbox-Message-UUID: ab733cda-ead0-11e9-9d60-3106f5b1d025 > Does it mean that USED() can only be applied on variables of "scalar > types"? But r is of a struct type in yes. > > void > drawresizewindow(Rectangle r) > { > USED(r); > > bad(); > } > > in $PLAN9/src/libdraw/nowsys-wsys.c. > > When compiling, 9c complains on that. A bug? Or an extension of Plan 9's > C dialect? In Plan 9's C compiler, USED is known to the compiler. It makes the compiler insert a use of the variable right there to silence used and not set warnings. In the ports, it's a clumsy macro trying to have the same effect. > perhaps it could use if(&x) instead of if(x) > to cope with structures as well I tried this once, but then some (too smart for their own good) compilers complain that the value is never used. Russ