Quoting Andrew Hood <[EMAIL PROTECTED]>: > Tony Balinski wrote: > > Quoting Andrew Hood <[EMAIL PROTECTED]>: > > > > > >>Andrew Hood wrote: > > > > > >>I now have a minimal set of changes against CVS HEAD ( hopefully > >>available from http://andyhood.net/cvs-2007-10-28-11-43-17UTC.diff.gz ) > >>allowing nedit to compile with > >> > >>CC=gcc -Wuninitialized -Wall -W -Werror -D_U_='__attribute((unused))' > > Oops typo. -D_U_='__attribute__((unused))' > > >>on Linux with gcc 2.95.3 and OpenMotif 2.1.30 and with gcc 4.1.2 and > >>OpenMotif 2.3.0. I have not as yet fixed all the other Makefiles. > > > > > > Don't much like these, I must say. Can't we just wrap the variable name > in > > a function-style macro as follows: > > gcc ... '-D_U_(var)=' > > then have function arglists such as > > int aFunc(XtPointer _U_(unused1), UserArg _U_(unused2)); > > and for compilers that don't like unnnamed args, use '-D_U_(var)=var' > > instead? > > This is a direct steal from the way Wireshark does it. Their default > compile options these days include -Werror so as to minimize the chances > of doing something stupid. > > Rather than '-D_U_(var)=' I'd prefer > > '-D_U_(var)=var __attribute__((unused))' > > which would be easier to make work with any compiler and possibly > simplify debugging by not having unnamed args.
Whatever. Since the argument isn't going to be used, whether it has a name or not is moot. It depends what the compiler understands. The advantage in using __attribute__ is that (presumably) the compiler will complain if you use the same name for a declared variable in the function's main scope. Non-GNU compilers presumably would define __attribute__(e) as nothing. The thing is that C89 allows a missing variable name for an argument for this sort of occasion, so why not use it? Tony -- NEdit Develop mailing list - [email protected] http://www.nedit.org/mailman/listinfo/develop
