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_at_FreeBSD.org)Received on Sun Jan 16 2005 - 23:42:11 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:26 UTC