Advertisement Jump to content
Sign in to follow this  
gjl

"default" keyword

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

Hi,

 

I have noticed that "default" is considered as a reserved keyword, so you cannot use it for variable names, whereas in C++ it's "default:" that is reserved. Is there any way to change that? It is causing me trouble while converting existing c++ code into angelscript...

Share this post


Link to post
Share on other sites
Advertisement

The keywords are part of the language. To modify the syntax by changing Angelscript it will technically be another language. So, as you can see, this may not be the best thing to do. Instead, can't you use another variable name like defaultPlayer or something like that?

Share this post


Link to post
Share on other sites
It's eleventy billion times easier to rename your variable to something else than it is to change the language.

Share this post


Link to post
Share on other sites
Are you saying that "default" is not a reserved keyword in C++? I think you are wrong.
int default = 5; // error: expected unqualified-id before ‘default’

Share this post


Link to post
Share on other sites

Which compiler are you using? With VS2012 this compiles just fine.

 

I know it's not a big deal, I was simply asking :-)

Share this post


Link to post
Share on other sites

Ah ok, thanks! Haden't tried with gcc yet. So I guess let's just forget about it then! :-)

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!