Skip to main content
GameDev.net gamedev.net
🔒 Locked

parameter with no name

Started by TEUTON Mar 28, 2006 at 8:20 PM 4 replies 500+ views
Original Post
TEUTON
TEUTON
Today i came across a code which had paramters with no name

void func(int){}

It gave an error in C but worked in C++...???
kuphryn
kuphryn
Interesting.

What compiler?

Kuphryn
dpadam450
dpadam450
well was there a prototpye of it before that code? Cuz it should work then. Im betting thats what it is. The definition probably just says int x or whatever, since functions are named by > name of the function, param_type, ..etc
NBA2K, Madden, Maneater, Killing Floor, Sims 
Sneftel
Sneftel
There's nothing wrong with not naming the parameter in the parameter list. You just won't have access to it. This is commonly done with arguments in overridden virtual functions which aren't going to be used, because the compiler usually won't issue an "argument not referenced" warning if the argument isn't named.
dave
dave
I've seen alot of function prototypes with nameless parameters, but not methods.

Learn something every day.

Dave
TEUTON
TEUTON
Ok..it makes sense now.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.