Jump to content

View more

Image of the Day

The beast has a mighty searchlight of evil! #screenshotsaturday https://t.co/bzKepOojDL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now
- - - - -

Default parameters within namespace

4: Adsense

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 iraxef   Members   

451
Like
0Likes
Like

Posted 05 June 2014 - 02:15 PM

I have some binding code along these lines:

engine->SetDefaultNamespace("MyNamespace");

engine->RegisterObjectType("MyType", sizeof(MyType), asOBJ_VALUE | as OBJ_POD | ...);

engine->RegisterObjectMethod("SomeObject", "MyType AFunction(MyType param = MyType()) const", ...);

If in script you call AFunction() and don't provide the default parameter, that script will fail to compile with:

Identifier 'MyType' is not a data type
A cast operator has one argument
Identifier 'MyType' is not a data type
The type of the default argument expression doesn't match the function parameter type

Is it possible to make the compiler look at the current 'default namespace' when resolving this default parameter?

 

Thank you!



#2 Andreas Jonsson   Moderators   

4630
Like
0Likes
Like

Posted 05 June 2014 - 05:03 PM

Yes, it should be possible to make the compiler use the namespace of function that the default arg is being evaluated for. I'll look into it.


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   

4630
Like
0Likes
Like

Posted 09 November 2014 - 01:11 PM

This has been implemented in revision 2049. Thanks.


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.