You folks who program C professionally or just frequently, what is your opinion on using Hungarian Notation? Do you find it necessary or very helpful?
The reason I ask is that I don't like it, so I rarely use it. However, I don't normally share my code either. The project I am working on now, I am trying to find a co-worker to help me with (since it's for work), and I may even just leave it with them if I leave. So I am wondering how important it'd be to start using Hungarian Notation for my variable names.
Thanks for the opinions.
I can't stand it. And thus far in my travels, my professors and co-workers seem to be the same way.
Making Wrong Code Look Wrong
At the bottom of this article, the author discusses why the original meaning of the Hungarian Notation has been forgotten and now everybody, including Microsoft, is using it wrongly.
A beautiful impediment to understanding, and utterly useless.
Unless you have a tool (no thanks) which can actually check that you've named everything properly, code all too rapidly degenerates into alphabet soup. Given that you have to assume that it's probably wrong, you have to do what you'd normally do anyway.
Besides, with today's IDE's, you simply click on a variable, and it tells you all about it, without having to decode whatever unreadable mess has been placed in front of the name.
Their argument: it allows you to figure out how a variable is declared without having to scroll back to read it.
My argument: if you need to scroll back, then either you're a goldfish or your function is already too damn big to be tested or maintained.
To me, it was only ever the equivalent of "training wheels" on your bicycle (if you can remember that far back).
Once you understand how the * and & work together (which the notation aims to emphasise), you can take the trainers off and get down to some serious work.
int *pi = &i;
int j = π
Wow, I didn't think such a small topic would have such strong feelings attached to it. Thanks for the input.
I suppose I don't find much use for the notation since the majority of my routines are small and since I use C instead of C++, (I really should switch) I am forced to declare my variables at the top anyway.
Now, since I am writing my winproc which is getting rather huge, I can see how this notation could sometimes help. Perhaps, I'll just use it sparingly.
use which notation you want. it isn't compiler dependant. if security is an issue, your final builded app will not have any reference the the original's source variables name.
i honestly don't use it simply because i don't find it necessary...