Jump to content

View more

Image of the Day

Working on an auto spawn system. #gamedev #indiedev #screenshotsaturday https://t.co/Mm2kfekz7b
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
- - - - -

Anonymous objects and initialization lists

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

270
Like
0Likes
Like

Posted 06 June 2014 - 06:37 AM

As i see in documentation this must work, but i have error.

void foo(dictionary d)
{
}
void foo2()
{
	foo(dictionary = { { "1", 1 }, { "2", 2 }, { "3", 3 } });
}

Output:

INFO : Compiling void foo2().
ERROR : Expected expression value.
ERROR : Instead found '{'.
ERROR : Expected expression value.
ERROR : Instead found ')'.



#2 Andreas Jonsson   Moderators   

4623
Like
0Likes
Like

Posted 06 June 2014 - 08:35 AM

It's a conflict with the named arguments features that was introduced in this WIP. I'll see if I can resolve this.

 

In the meantime you can work around it by putting the anynomous object expression between parenthesis, like this:

 

void foo2()
{
   foo( (dictionary = { { "1", 1 }, { "2", 2 }, { "3", 3 } }) );
}

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   

4623
Like
0Likes
Like

Posted 06 June 2014 - 06:06 PM

It turns out that it was quite trivial to fix. You can get the fix in revision 1950.

 

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.