This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: __attribute__((unused)) is ignored in C++



> [This bug was reported to the Debian bug tracking system. Please CC
>  to 45440@bugs.debian.org.]
> 
> Tested with gcc-2.95.2
> 
> egcs ignores the __attribute__ syntax to mark a function parameter
> unused, and then complains when it is not used.  This only happens
> when compiling C++, not C.

While this should be fixed, it tends to get low priority because there
is a standard, portable way in C++ to indicate that a variable is not
used:

int foo2(int)
{
	return 1;
}

If you want to give the argument a name for documentation purposes,
the style I use is

int foo2(int /* x */)
{
	return 1;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]