C++: Unused parameter even when unnamed

Chip Salzenberg chip@valinux.com
Fri Jun 9 15:43:00 GMT 2000


Given this:

     void foo(int x);
     void foo(int) {}

G++ complains that "x" is unused.  But the whole point of not giving
the parameter a name in the definition is to tell the compiler that
it's not supposed to be used.

Surely giving parameters names in prototypes isn't supposed to be a
Bad Idea?
-- 
Chip Salzenberg              - a.k.a. -              <chip@valinux.com>
"I wanted to play hopscotch with the impenetrable mystery of existence,
    but he stepped in a wormhole and had to go in early."  // MST3K


More information about the Gcc-bugs mailing list