On Jul 27, 2012, at 2:38 AM, Luigi Rizzo wrote:
>
> The alternative way to avoid an 'unused' warning from the compiler
> is an empty statement
>
> (void)foo;
>
> that the compiler hopefully optimizes away.
I learned the void-cast convention many years ago.
I used it throughout the libarch
In message <20120727125134.ga58...@onelab2.iet.unipi.it>, Luigi Rizzo writes:
>A comment might be used to explain the intention in even more detail:
>
> (void)foo; /* unused on XyBSD and Babbage-OS */
Comments are noise which compilers and static checkers cannot and
should not examine.
I'd rather see a compiler-interpretable "way" of doing this.
You could always just use your own for now, until something comes
along (like how many #define N(a) there are in the tree, until nitems
showed up.)
Ie:
#define A_UNUSED_Tvoid
(A_UNUSED_T) foo;
That way (a) it's easy to change wit
On Fri, Jul 27, 2012 at 11:20:48AM +, Poul-Henning Kamp wrote:
> In message <20120727093824.gb56...@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 abo
In message <20120727093824.gb56...@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.
S
On 2012-07-27 11:38, Luigi Rizzo wrote:
> In writing cross platform code I often have to deal with function
> arguments or variables that are not used on certain platforms.
> In FreeBSD:sys/cdefs.h we have
>
> #define __unused__attribute__((__unused__))
>
> and in the kernel we tend
Hi,
On Fri, 27 Jul 2012 11:38:24 +0200
Luigi Rizzo wrote:
> In writing cross platform code I often have to deal with function
> arguments or variables that are not used on certain platforms.
> In FreeBSD:sys/cdefs.h we have
>
if I understand you right here, it is you own code that has to run on
In writing cross platform code I often have to deal with function
arguments or variables that are not used on certain platforms.
In FreeBSD:sys/cdefs.h we have
#define __unused__attribute__((__unused__))
and in the kernel we tend to annotate with "__unused" such arguments