Thread: Hungarian Notation

  1. #1
    Registered User
    Join Date
    Jan 2005

    Hungarian Notation

    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.

  2. #2

  3. #3
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    I can't stand it. And thus far in my travels, my professors and co-workers seem to be the same way.

  4. #4
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    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.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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).
    int i;
    int *pi = &i;
    int j = π
    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.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Jan 2005


    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.

  7. #7
    Registered User
    Join Date
    Jun 2004
    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...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CamelCase VS Hungarian notation, which is better?
    By meili100 in forum C++ Programming
    Replies: 4
    Last Post: 04-22-2007, 09:31 PM
  2. is prefixing by Hungarian notation important?
    By MathFan in forum C++ Programming
    Replies: 16
    Last Post: 06-01-2005, 02:15 AM
  3. Hungarian Notation POLL
    By maxhavoc in forum A Brief History of
    Replies: 13
    Last Post: 06-21-2004, 10:52 AM
  4. hungarian notation
    By confuted in forum C++ Programming
    Replies: 2
    Last Post: 07-28-2003, 01:19 PM
  5. Hungarian Notation
    By gamegod3001 in forum A Brief History of
    Replies: 24
    Last Post: 10-13-2001, 11:17 AM