Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


- - - - -

Nameless arguments cannot have default values


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Sir Ementaler   Members   -  Reputation: 602

Like
0Likes
Like

Posted 03 July 2013 - 05:42 AM

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, 03 July 2013 - 05:45 AM.


Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3451

Like
0Likes
Like

Posted 03 July 2013 - 08:49 AM

I'll look into what changes may be needed in the code to support this. 

 

Regards,

Andreas


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 Andreas Jonsson   Moderators   -  Reputation: 3451

Like
0Likes
Like

Posted 11 August 2013 - 11:45 AM

I've added support for this in revision 1693.

 

Regards,

Andreas


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS