• Advertisement
Sign in to follow this  

Nameless arguments cannot have default values

This topic is 1625 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 think the topic name accurately describes the problem I encountered while using AngelScript. It's not a major error, but it bothers me. For reference, C++ standard allows nameless function arguments with default values:

void foo(int=0);

AngelScript supports both nameless function arguments (foo(int)) and default values of arguments (foo(int unused=0) - currently the best substitute, but if this were C++, some compilers would generate a warning about an unused argument), but the above code is for no apparent reason considered incorrect.


Now I realize your first thought might be that something like this is completely useless. I already went through explaining how it can be used to my friend, whose first response was "it really feels like you should be doing whatever you're doing in another way", but who later admitted this solution would be the best one. I don't want to get into detail again; in short, it's about functions that have to fit a certain funcdef, so they support handles of that kind, but at the same time are also meant to be called from code directly.

Edited by Sir Ementaler

Share this post

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

  • Advertisement