🔒 Locked
What notation do you use?
Advertisement
Original Post
I normally use camelBack, thought every once in a while I''ll use Hungarian, but only for a select class or two. And normally without the data type description (like b for bool). The only thing Hungarian really does for me is make it easier to see which variables are member functions of the class (m_position, for instance).
|.dev-c++.|.the gimp.|.seti@home.|.dbpoweramp.|.torn.|.=w=.|
|.dev-c++.|.the gimp.|.seti@home.|.dbpoweramp.|.torn.|.=w=.|
I''m guessing Carmack code is just completely illegible code
That''s sort of like me sometimes. I use the m_ prefix for class members. I also use g_ for globals.
Firebird Entertainment
Firebird Entertainment
I use m_ for members and g_ for globals, too.
I precede long pointers with lp as well. m_lpChild, for example.
Also, for my own convenience, if a pointer is a reference to an existing memory block but was not used to allocate it, I put Ref on the end so I don't try to delete it within the class's destructor. (m_lpTargetRef)
I usually fail to put i, l, dw, f, etc. in front of ints, longs, double words and floats. That's a practice I'll have to improve on.
[edited by - Waverider on March 3, 2003 6:51:38 PM]
I precede long pointers with lp as well. m_lpChild, for example.
Also, for my own convenience, if a pointer is a reference to an existing memory block but was not used to allocate it, I put Ref on the end so I don't try to delete it within the class's destructor. (m_lpTargetRef)
I usually fail to put i, l, dw, f, etc. in front of ints, longs, double words and floats. That's a practice I'll have to improve on.
[edited by - Waverider on March 3, 2003 6:51:38 PM]
I use camelBack most of the time. I occaisonally prefix things if it makes it easier to understand.
I always use p in front of pointers. e.g. pPointer
I use s in front of strings if it isn''t clear it''s a string, like sTemp, but not fileName.
I almost never prefix integers of floats or any numerical things. I generally do prefix classes with a c, like cModel.
I always use p in front of pointers. e.g. pPointer
I use s in front of strings if it isn''t clear it''s a string, like sTemp, but not fileName.
I almost never prefix integers of floats or any numerical things. I generally do prefix classes with a c, like cModel.
quote:
Original post by Waverider
I use m_ for members and g_ for globals, too.
I precede long pointers with lp as well. m_lpChild, for example.
Also, for my own convenience, if a pointer is a reference to an existing memory block but was not used to allocate it, I put Ref on the end so I don't try to delete it within the class's destructor. (m_lpTargetRef)
I usually fail to put i, l, dw, f, etc. in front of ints, longs, double words and floats. That's a practice I'll have to improve on.
This works great for me too. I find really usefull to have al my member variables preceded by m_ so I can name the parameters on my methods with the same name as the member variable when required (ie: m_iPosX = iPosX; ). Writing the initial of the data type is also good when you have lotta varibles and you dont want to memorize the type of every variable.

[edited by - xaxa on March 3, 2003 6:58:09 PM]
quote:
Original post by Waverider
Oh, I also put p_ in front of parameter names, so that I know in a large function which variables are parameters, and which are members, globals and locals.
If the variable has no m_, g_ or p_, I know it''s a variable local to the function.
you could easily misread and think the parameter is a pointer. And pointer parameters will look like p_piXpos, weeee
I must be what you call a "old_school_unix_c" guy. For variables at least. For functions and (non-"atomic") classes/structs/types I use the Hungarian variant (ie. SomeFunction()). For "atomic" classes I use STL-like naming.
I tried at some point to use Hungarian for variables, but it fails, and without thinking of it I started to move to "old_school_unix_c" notation, it seems so much more natural, and never fails.
camelBack, I cannot stand; it''s just soo damn ugly. Who is Carmack?
Shall I go get the flame thrower now?
I tried at some point to use Hungarian for variables, but it fails, and without thinking of it I started to move to "old_school_unix_c" notation, it seems so much more natural, and never fails.
camelBack, I cannot stand; it''s just soo damn ugly. Who is Carmack?
Shall I go get the flame thrower now?
The irony is that your nickname is "CWizard." 
BTW, John Carmack is the guy who made iD games like Doom and Quake.
Firebird Entertainment
BTW, John Carmack is the guy who made iD games like Doom and Quake.
Firebird Entertainment
I use old_school_unix_c, it seems the most natural to me. It works best with stl and looks like crap for Win32, OpenGL, etc.
A mixture of Hungarian Notation, Camel Back and old_school_unix_c
quote:
Original post by Sneftel
I use 31337 notation. It really gives your programming style so much more flexibility to have declarations like:
int w0ot( int wO0t, int w0Ot)
{
int wo0t = w0Ot % wO0t;
if(wo0t != 0) return w0ot(wo0t, wO0t);
return wO0t;
}
But... but that''s what HITLER would say!!
When I write my book on beginning programming, I think I''ll use eleet notation. I see that it is very flexible, and better yet, easy to understand.
I mainly use a smorgasboard of notations. I generally use old_school_unix_c for variable names, and everything else in that sub-Hungarian notation that you guys seem to do. I''m trying to completely switch over to old_school_unix_c or camelBack though.
None of the above!
For me, variables are usually lowercase and functions are usually of the form SomeFunction(). Classes and class members usually follow the naming of functions.
Qui fut tout, et qui ne fut rien
Invader''s Realm
For me, variables are usually lowercase and functions are usually of the form SomeFunction(). Classes and class members usually follow the naming of functions.
Qui fut tout, et qui ne fut rien
Invader''s Realm
For assembly, always old_school_unix.
For C, usually old_school_unix, with prefixes and suffixes like timer_int, hd_int, kstart, kmain. (prefixes don''t have the _)
[ Enter the Unspoken Realm ]
For C, usually old_school_unix, with prefixes and suffixes like timer_int, hd_int, kstart, kmain. (prefixes don''t have the _)
[ Enter the Unspoken Realm ]
I use my own notation 
CClassesAreLikeThis
FunctionsAreLikeThis();
For member variables (and globals, which I don''t use) I use
m_iHungarianNotation
when I can be bothered, but often fall back to
alllowercase
which is a bit flawed, because I also use alllowercase for parameters.
I have also found a few instances where my type has been so long (and written out in full), that my variable name looks like m_camelBack (yes, with the m_ tagged on the front), and I just hate camelBack.
Btw, I really like the idea of tagging "Ref" on the end of a pointer to something that is not to be deleted using that pointer.
ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Asking Questions | Go FAQ yourself ]
CClassesAreLikeThis
FunctionsAreLikeThis();
For member variables (and globals, which I don''t use) I use
m_iHungarianNotation
when I can be bothered, but often fall back to
alllowercase
which is a bit flawed, because I also use alllowercase for parameters.
I have also found a few instances where my type has been so long (and written out in full), that my variable name looks like m_camelBack (yes, with the m_ tagged on the front), and I just hate camelBack.
Btw, I really like the idea of tagging "Ref" on the end of a pointer to something that is not to be deleted using that pointer.
Do not meddle in the affairs of moderators, for they are subtle and quick to anger.
ANDREW RUSSELL STUDIOS
Cool Links :: [ GD | TG | MS | NeHe | PA | SA | M&S | TA | LiT | H*R ]
Got Clue? :: [ Start Here! | Google | MSDN | GameDev.net Reference | OGL v D3D | File Formats | Asking Questions | Go FAQ yourself ]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement