From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] USED() macro
Date: Sat, 12 Nov 2005 08:17:45 -0500 [thread overview]
Message-ID: <ee9e417a0511120517x32c84b18w1c7062bf3e298ea@mail.gmail.com> (raw)
In-Reply-To: <0127f0e483812bde9207dcadeb8a009f@terzarima.net>
> 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
next prev parent reply other threads:[~2005-11-12 13:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-12 10:00 李微
2005-11-12 11:18 ` Charles Forsyth
2005-11-12 13:17 ` Russ Cox [this message]
2005-11-12 14:42 ` 李微
2005-11-12 16:37 ` Russ Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee9e417a0511120517x32c84b18w1c7062bf3e298ea@mail.gmail.com \
--to=rsc@swtch.com \
--cc=9fans@cse.psu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).