Hungarian Notation vs. IntelliSense
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
-
I have been unable to get my mouse cursor to hover over my source code printouts. Tim Smith Descartes Systems Sciences, Inc.
I think Mike Dunn wrote a shell extension for that. :-D
-
I have been unable to get my mouse cursor to hover over my source code printouts. Tim Smith Descartes Systems Sciences, Inc.
Are you using PAPER.NET? ;)
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
I used to love Hungarian notation, but the MSDN is proof of it's inadequacies. How many basic types have changed ( wParam for example ) and now have names that imply they are something they are not ? I always use p for a pointer, otherwise I find it to be of no value. Visual Assist tells me what type a variable is anyhow, and I have no use for looking over source code on paper, where I cannot edit it if I want to. Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
IntelliSense only works about 50% of the time for me. the other 50% it's either wrong or unresponsive. So, it's essentially useless since you don't know if you've mispelled a variable name or if IntelliSense is just sleeping again. Hungarian should be the 11th Commandment: In statically typed languages, thou shalt use a name that describes the variable's type. -c ------------------------------ Smaller Animals Software, Inc. http://www.smalleranimals.com
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
I never uses the mouse, everything in VC++ can be done using the keyboard which I find a whole lot faster. So Hungarian Notation is a must, at least for me. But your mileage may vary :)
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
I program mainly with the keyboard too, so I use Hungarian notation. I don't attach absurd 50-character prefixes though, most of my prefixes are 1 character in length.
-
I used to love Hungarian notation, but the MSDN is proof of it's inadequacies. How many basic types have changed ( wParam for example ) and now have names that imply they are something they are not ? I always use p for a pointer, otherwise I find it to be of no value. Visual Assist tells me what type a variable is anyhow, and I have no use for looking over source code on paper, where I cannot edit it if I want to. Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.
All true. I don't use Visual Assist (shame on me, I know), but I do use the 'p', 'm_', 'g_', 'n', 'sz' prefixes. Unlike some of the sxuggestions in the guide to Hungarian Notation in MSDN I don't absolutely mad and notate absolutely everything about a variable. > Andrew.
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
One reason I use the "m_":
void MyClass::SetValue(int nValue)
{
m_nValue = nValue;
}If I didn't use the 'm_' I'd have to think of different names for the member variable and the parameter. WAY too hard ;) cheers, Chris Maunder
-
All true. I don't use Visual Assist (shame on me, I know), but I do use the 'p', 'm_', 'g_', 'n', 'sz' prefixes. Unlike some of the sxuggestions in the guide to Hungarian Notation in MSDN I don't absolutely mad and notate absolutely everything about a variable. > Andrew.
Sounds like you're taking a sensible approach - doing it when it makes sense instead of because it's the 'done thing'. Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.
-
One reason I use the "m_":
void MyClass::SetValue(int nValue)
{
m_nValue = nValue;
}If I didn't use the 'm_' I'd have to think of different names for the member variable and the parameter. WAY too hard ;) cheers, Chris Maunder
... And of course, it's even harder to use this->nValue = nValue; ;) I personally don't like Hungarian Notation, but it's almost a standard in Win32 programming. What I hate the most is the Win32 typedefs like: LPCTSTR, LPTSTR, LPxxx etc. X|
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
I do not think IntelliSense has much to do with it. I use more hungarian now with VC than before. I agree with Chris, m_ is good to note scope and p for pointers. Beyond that I rather use a discrptive title than religiously following some dictate. However most of what I write is not code that any programmer that does not know the purpose of the code should be editing. If they do, then usually they know what the variable type should be anyways. Code that is more general purpose I try to follow "standards" if they make sense.
-
One reason I use the "m_":
void MyClass::SetValue(int nValue)
{
m_nValue = nValue;
}If I didn't use the 'm_' I'd have to think of different names for the member variable and the parameter. WAY too hard ;) cheers, Chris Maunder
Aside from Hungarian (I do like the m_ notation), I like to name parameters with a trailing underscore.
void MyClass::BigFunction(int nValue_)
{
// ... reams of code
m_nValue = nValue_; // trailing '_' helps me remember that
// nValue_ is a parameter, not a local
// variable.
} -
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
One more aspect of naming, it's easy to look at lists of names (for instance in a .map file or dumpbin output) and tell what's what. You can always use
UndecorateName()
to get some of this information but it's incomplete and inconvenient. It's good to be able to grep through code and such for global variables, member attributes, functions, local variables, function arguments, etc. Thus, I get most mileage from the stuff before the underscore (I usem_
,s_
(static member),g_
(global),sc_
(static const member),gc_
(const global), and (rarely)mc_
(const member)). I have gotten in the habit of using Hungarian everywhere because it helped me out when I was first writing Windows code, but it is much less useful to me now. More of a bad habit that I haven't broken or learned to moderate (is there a local chapter of Hungarians Anonymous in Tennessee? :-)). -
All true. I don't use Visual Assist (shame on me, I know), but I do use the 'p', 'm_', 'g_', 'n', 'sz' prefixes. Unlike some of the sxuggestions in the guide to Hungarian Notation in MSDN I don't absolutely mad and notate absolutely everything about a variable. > Andrew.
Same here.
-
Aside from Hungarian (I do like the m_ notation), I like to name parameters with a trailing underscore.
void MyClass::BigFunction(int nValue_)
{
// ... reams of code
m_nValue = nValue_; // trailing '_' helps me remember that
// nValue_ is a parameter, not a local
// variable.
}Parameters are local variables.
-
The purpose of Hungarian notation is to include the variable's type in its name so programmers know the type whenever the variable is used. Have any of you using Visual C++ 6 hovered the cursor over a variable? Henry casually scans the room searching a fire extinguisher.
Hi, Some of us have to compile our C++ code on: Windows, UNIX, VMS, AS400, Tandem and MVS. And my mouse don't fly ;) Old Simon
-
I used to love Hungarian notation, but the MSDN is proof of it's inadequacies. How many basic types have changed ( wParam for example ) and now have names that imply they are something they are not ? I always use p for a pointer, otherwise I find it to be of no value. Visual Assist tells me what type a variable is anyhow, and I have no use for looking over source code on paper, where I cannot edit it if I want to. Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.
Some of the worst C++ I have seen is in the MFC source and to a lesser extent on MSDN, but to be fair quite a lot of it is quite old. Then again, if you want poor code just look at SAP (on second thoughts, better not - it's very depressing). Old Simon