Jump to content
  • Advertisement
Sign in to follow this  
TEUTON

parameter with no name

This topic is 4586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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++...???

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
I've seen alot of function prototypes with nameless parameters, but not methods.

Learn something every day.

Dave

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!