(void)foo or __unused foo ?
Poul-Henning Kamp
phk at phk.freebsd.dk
Fri Jul 27 11:28:20 UTC 2012
In message <20120727093824.GB56662 at onelab2.iet.unipi.it>, Luigi Rizzo writes:
>The alternative way to avoid an 'unused' warning from the compiler
>is an empty statement
>
> (void)foo;
The thing I don't like about this form, is that it doesn't communicate
your intention, only your action.
Somewhere down my TODO list I have an item to propose instead:
typedef void unused_t;
int main(int argc, char **argv)
{
(unused_t)argc;
(unused_t)argv;
return (0);
}
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-current
mailing list