[sane-devel] How to avoid gcc warnings (was: hs2p backend)

Mattias Ellert mattias.ellert at tsl.uu.se
Tue Nov 20 18:29:07 UTC 2007

20 nov 2007 kl. 12.32 skrev Volker Grabsch:

> On Mon, Nov 19, 2007 at 11:36:20AM -0500, m. allan noah wrote:
>> ok, lets start by saying that lots of other sane backends produce
>> warnings, and i am probably running a newer version of gcc than you,
>> so it's not a requirement that we remove all of them. it's just a pet
>> peev of mine.
>> 1. if you put a little 'arg = arg;' line in the function, gcc will
>> shutup about the param.
> I'd rather recommend:
>    (void)arg;
> because this command has no "action". ('arg = arg;' is an assigment)
> This solution also works better for 'const' arguments.

You can also leave the parameter unnamed in the declaration:

sense_handler (int scsi_fd, u_char * result, void*)

This will also get rid of the warning.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1438 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20071120/f5b48717/attachment.bin 

More information about the sane-devel mailing list