|
I use somewhat of a mix of Hungarian notation and Camel Caps.
For example, all object and reference variables start with a prefix obj or ref . Pointers are p . Global variables have a prefix g_ . For standard variables, 'n' is integer, 's' is short, 'c' is char, 'l' is long, 'f' is float and 'd' is double. For pointer-to-value types, only the pointer prefix is used, aka the type of pointed-to is not visible in the declaration.
I've fathomed a small syntax for my variables
expr:
[g_][type][name in Camel Caps]
The problem is that if I have a type double, like in g_dMaxSum , and I need to change it to float, it's always a find & replace run.
I use this for all languages I use. It might be difficult to read, and problematic in change situations, but I like it
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|
|
This way, looking at code, I can't tell the type of a thing, but I can tell
what scope it has.
prefix meaning
"a" attributes
"g" static or global
"k" constant
"p" parameter
ex:
extern const COLORREF kDefaultColor;
struct TPixel {
COLORREF aBackColor;
CPoint aPosition;
void color( COLORREF pColor = kDefaultColor);
COLORREF color() const;
};
Furthermore, I use "C" or "T" to denote a C++ TYPE or a C STRUCT.
On member function accessors, I use "camelCase".
On member function not use for accessors, I use "PascalCase".
On local (stack) variable, I use "c_style_case".
I think that encoding the TYPE of something in a variable name defeats the
purpose of a language with strong type checking emphasis, such as C++.
I find it easyer to encode the scope. At least, it makes it easy to read.
|
|
|
|
|
My C++ code still uses Hungarian but my C# code follows the new guidelines and so is mainly camelCase for variables and PascalCase for methods.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Same here. But with C# I still have a small piece of Hungarian in that I use m_ for object level variables.
Regards,
Brian Dela
Now Bloging![^]
|
|
|
|
|
Brian Delahunty wrote:
I use m_ for object level variables
I still use the "m_ " prefix for variables in a dialog box that are subject to dialog data exchange. Old habits die hard, I suppose.
Software Zen: delete this;
|
|
|
|
|
i assume this refer to Hungarian notation with prefixes.
|
|
|
|
|
In fact, this time, CListCtrl is not that off-topic and therefore should be avoided for this survey.
--
Affordable Windows-based CMS: www.zeta-producer.com
|
|
|
|
|
I do use prefixes sometimes but only in a few cases:
1) A leading 'm' to show module level vars
2) A prefix to show referances to controls (ie: frm, cmd, cmb, etc...)
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
like i Created prefix l_ for local member of function
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
I also put s_ in front of variables declared 'static' at file scope.
I put S_ in front of functions declared static at file scope.
|
|
|
|
|
i like this idea i think i will adopt this for static variables. i find it very important to know which ones are static when i find i have to use one, but i never had a consistent way of indicating them.
zen is the art of being at one with the two'ness
|
|
|
|
|
Same thing for using g_ for global objects. Also:
ms_ for member static variables.
gs_ for global static variables.
I also do the S_ for static member methods/functions.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites
|
|
|
|