Date: Sun, 16 Jan 2005 16:42:09 -0800 From: "David O'Brien" <obrien@freebsd.org> To: Garance A Drosihn <drosih@rpi.edu> Cc: Robert Watson <rwatson@freebsd.org> Subject: Re: gratuitous gcc warnings: unused function arguments? Message-ID: <20050117004209.GA62371@dragon.nuxi.com> In-Reply-To: <p06200722be10a1a3bf88@[128.113.24.47]> References: <Pine.NEB.3.96L.1050116120744.50371A-100000@fledge.watson.org> <p06200722be10a1a3bf88@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jan 16, 2005 at 06:16:49PM -0500, Garance A Drosihn wrote:
> In this specific case, would it make sense to change the code to be:
> int
> dummyfunction(int arg1, int arg2, char *argv)
> {
>
> if (DUMMY_USES_ARGV && (argv != NULL))
> printf("dummyfunction: %s\n", argv);
> return (arg1 + arg2);
> }
>
> ?
>
> This does mean you must always define DUMMY_USES_ARGV to be 0 or 1
> (which is easy enough to do by using an #ifndef check up at the start
> of the file). But it does remove the warning message (at least in gcc),
> and in my testing it also seems to produce the same-size object-code
> as the #ifdef version.
I like this version much better. Requiring a #define symbol to be a set
value isn't so bad. In fact it is a requirement in GCC'ville -- along
with not using #ifdef, but rather "if(SYMBOL && )" so that all(most) code
will be syntax checked an a build on arch system has less chance of
breaking the build for another arch.
--
-- David (obrien@FreeBSD.org)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050117004209.GA62371>
