Jump to content
  • Advertisement
Sign in to follow this  

Expressions for default arguments

This topic is 2536 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

I see that default arguments only support constants (nothing else is even parsed). Is it possible to add support for actual expressions (evaluated in the same scope as the function)? Then things like this are possible:

class T
int A;

void f(int a=5*A) { }

Currently i can't even put some of my macros as default arguments because they evaluate to things like (15), which is a proper expression but the parser dislikes the parentheses very much.

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!