[sane-devel] Some warnings/errors - please verify your backends

der Mouse mouse at Rodents.Montreal.QC.CA
Thu Apr 3 03:21:48 BST 2003


>> - A lot of "unused parameter" warnings.  I saw some SANE code that
>>   does "var=var;" to quell such warnings, so presumably at least
>>   some people care.
> I've seen such code as well and find it horribly inelegant.

Me too.  When writing for myself, I use __attribute__((__unused__)),
because I'm perfectly content to write in gcc rather than C.  (And not
just for this; I tend to use other gccisms that C doesn't have too.)

> Any good reasons why you can not replace: [edited for size -dM]
> void useless_func( int arg ) { arg = arg; }
> with
> void useless_func( int ) { }

The same reason to not use __attribute__((__unused__)): it's not C and
thus isn't portable across C environments.

> This gets rid of the "unused parameter" warnings just fine (with gcc
> at least)

??!  What version of gcc?  Here's what I see:

% cat z.c
void useless_func(int) { }
% gcc --version
egcs-1.1.2
% gcc -c z.c
z.c: In function `useless_func':
"z.c", line 1: parameter name omitted
% 

...yes, it got rid of the "unused parameter" warning, I'll grant that.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse at rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B



More information about the sane-devel mailing list