Jump to content
  • Advertisement
Sign in to follow this  
Quat

[.net] Style for const variables

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

So I think for public constant variables, the recommended style is Pascal: RedValue What about private constant variables? Is it okay to use all uppercase? private const int TEXT_WIDTH = 200; Or should I still stick with the Pascal style?

Share this post


Link to post
Share on other sites
Advertisement
There are many different styles. I personally hate the look of all caps and only use it for pre-processor defines. For anything else I use this_style like any other variable.

I think most people here probably use all caps for all constants though.

Share this post


Link to post
Share on other sites
Yeah I use ALL_CAPS_WITH_UNDERSCORES for all constants, regardless of public or private scope.

Share this post


Link to post
Share on other sites
Why would you use a different case just because the scope is different? I'm personally trying to get away from the all caps and underscores in the middle of variable names.

Share this post


Link to post
Share on other sites
Same here. No more underscores, no more all-caps. All identifiers are named the same regardless of their scope. Everything uses either camel case or pascal case.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!