(void)foo or __unused foo ?

Erich Dollansky erichfreebsdlist at ovitrap.com
Fri Jul 27 09:44:53 UTC 2012


Hi,

On Fri, 27 Jul 2012 11:38:24 +0200
Luigi Rizzo <rizzo at iet.unipi.it> 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
different platforms.

I can only tell what we are doing since a long long time. We have one
file which handles all these things in one central location.

This makes all other files independent of the platform but this one
file might needs some work when a new platform comes in or things
change on one platform.

> Any disadvantage or objection to selectively use this form
> in our kernel code for parts that need to work on multiple
> platforms ?

This concept also works inside a kernel, driver or in the world. The
concept should then be limited to the module.

Erich


More information about the freebsd-current mailing list