Some input needed :D

Grab your favourite IDE and tinker with the innards of game engines

Some input needed :D

Postby WaterRatj on Sat Sep 22, 2012 1:28 am

Was just looking again after a while that I planned my Source2007 mod.
And was wondering when do people use these 'not sure how to call it'.
I'll just give some examples.

bool m_bLastRoundOver;
int m_iBuildRounds;
int m_iCombatRounds;
int m_iBuildFallDamage;

Just took these from SourceForts just as an example.
Seen these all over the SDK.

Can anyone explain them to me. Not the command itself offcourse cause that depends on mod.
But I know that the b in "m_b" stands for bool (lets hope i'm right.)
And the i in "m_i" for int.

but why use m_ ? there a meaning to it?
Also is there a list with examples as general coding guide?
like for other types?

Hope I make a bit sense :p
WaterRatj
Member
Member
 
Joined: Wed Mar 02, 2011 1:45 pm

Re: Some input needed :D

Postby stoopdapoop on Sat Sep 22, 2012 3:44 am

it's called hungarian notation

http://en.wikipedia.org/wiki/Hungarian_notation

valve appears to be using the "systems" variant, according to wikipedia. I don't use hungarian notation in my own coding projects so I'm not familiar with any of the subtleties.

"m_" means that it's a member variable.
I'm Brown
Image
User avatar
stoopdapoop
Veteran
Veteran
 
Joined: Sun Aug 21, 2005 2:14 am
Location: Ann Arbor, MI

Re: Some input needed :D

Postby SM Sith Lord on Sat Sep 22, 2012 5:49 am

I used that notation when I made my mod simply to be consistent with the rest of the code. It is pretty handy in reminding you which vars are members, static, or local.
SM Sith Lord
Been Here A While
Been Here A While
 
Joined: Sat Nov 25, 2006 4:25 pm
Location: Los Angles, CA

Re: Some input needed :D

Postby stoopdapoop on Sat Sep 22, 2012 9:22 am

oh absolutely, when working with an existing codebase it makes sense to use whatever is already in place. when I said "my own coding projects" I mean the ones that I start from scratch.
I'm Brown
Image
User avatar
stoopdapoop
Veteran
Veteran
 
Joined: Sun Aug 21, 2005 2:14 am
Location: Ann Arbor, MI

Re: Some input needed :D

Postby Garrador on Sat Sep 22, 2012 1:41 pm

Like he saus. Member variable of a class, and the variable type: i = integer (some use 'n') b = boolean, str or sz is most often string or an array of chars ( which is the same really ). So i.e a member pointer to string could be: m_pszName or just m_pchName. Nice to get used to as you identify its type and properties. Do the same for local variables w/o the 'm_' prefix.

Object = obj or nothing
Int - i or n
Bool - b
Char - c or ch
String - sz, psz ( c# often str)
Enum - e
Interface declaration - IName
Class declaration - CName ( S_CName for server, and C_CName for client)

Probably some more.
You click on Build or type
make (or some equivalent), and you are astonished, then mortified, as you realize that the whole world is being
recompiled and relinked!
- Scott Meyers
User avatar
Garrador
Veteran
Veteran
 
Joined: Fri May 12, 2006 10:39 pm
Location: Norway

Re: Some input needed :D

Postby WaterRatj on Sat Sep 22, 2012 6:27 pm

Thank you for your replies.
WaterRatj
Member
Member
 
Joined: Wed Mar 02, 2011 1:45 pm

Return to Programming

Who is online

Users browsing this forum: No registered users