Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


good variable naming practices

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

Hey, I''m pretty experienced at C++ but just started coding again and haven''t done it in a while.. I''ve found the thing I forgot were all the good habits for naming variables. (Should globals be all caps?? Is it bad to use shift in variable names??)E.g. ShipLocationX. All that stuff used to be second nature to me, but now I''m butchering my projects by being very inconsistent with naming practices. Can anyone point me to a good article on the subject to refresh my memory? Thanks in advance.

Share this post

Link to post
Share on other sites
i usually do this:

for integers:

edit: blnVarName


for private variables
_varname //use the prefixes mentioned above too
public variables
VarName //use the prefixes mentioned above too

btw in ur example u said ShipLocationX, just create a point(this is vb, im not sure about C++)
Dim pntShipLocation As Point
//later in ur code:
pntShiplocation.X = something
pntShipLocation.Y = something

i thjink in C++ it would look like
Point pntShipLocation;
pntShipLocation->X = something;
pntShipLocation->Y = something;

(not too sure about the C++ tho)

[edited by - The Pentium Guy on March 19, 2004 5:46:03 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!