View Poll Results: Is Hungarian Notation good or bad?

Voters
25. You may not vote on this poll
  • It is good.

    8 32.00%
  • It is bad.

    8 32.00%
  • I don't care.

    9 36.00%
  • What is Hungarian Notation?

    0 0%

Hungarian Notation

This is a discussion on Hungarian Notation within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Good or bad?...

  1. #1
    31173 h4x0r gnu-ehacks's Avatar
    Join Date
    Nov 2001
    Posts
    556

    Hungarian Notation

    Good or bad?
    What will people say if they hear that I'm a Jesus freak?
    What will people do if they find that it's true?
    I don't really care if they label me a Jesus freak, there is no disguising the truth!

    Jesus Freak, D.C. Talk

    -gnu-ehacks

  2. #2
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    int inum;
    double dcalc;
    float fmoney;

    Well, it's good in the sense that you can tell what type you are dealing with without having to go back to the point where the variable was defined, but with a good editor you just have to put your cursor on top of the variable and it will tell you all about it, so it's not necessary to use hungarian notation.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    I use it only in WIN32 API.

    I only started using it after I spent two days looking for an error. I found I had mixed a memory handle and an array variable name. If I had been using the notation it would not have happened.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    i've never used it... not since my projects don't get that large... it's rather that the scope of my code blocks never get that large... and isn't compact coding and blackbox functional units _the_ principle of C/++ programming? that's what i've always done... i probably got this idea from Herbert Schildt and 1984, but enough about that...
    hasafraggin shizigishin oppashigger...

  5. #5
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    -sigh-, I can't believe we're talking about this again...

    I love Hungarian notation ONLY when it's required, such as team projects or large programs, but if you're making a quick calculator, I don't think you should bother at all, specially when you're making an integer called i, you should name it Ii, and this could lead to serious confusions, specially because you might confuse the capital letter and type "iI", or "II" or maybe even "2" when you're really confused (please don't make me explaint that joke for you)

    Oskilian

  6. #6
    Still A Registered User DISGUISED's Avatar
    Join Date
    Aug 2001
    Posts
    499
    It was required in my first C course....Just as a learning/debugging tool I suppose. It was never really that big of a deal or confusing to me. I was taught to never use i as an integer outside of a for loop. It's good practice to use more descriptive variable names anyways, and this can be a good way to help.

  7. #7
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    It's good, it's hungarian .

    Didn't like it when had to deal with it for the first time, but now I use it always. If you're working in a team, on a bigger project, it's inevitable to use it. Especially in 4th generation programming languages.

  8. #8
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Don't use it, never have, regulaly work in a team, often on multi-million line code jobs. If you're a professional and your IDE can't tell you what type your variable is, then you're using the wrong tools.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  9. #9
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    Hehe, Adrianxw, what a deją-vu feeling

    We had that discussion a few months ago.

  10. #10
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    >If you're a professional and your IDE can't tell you what type your variable is, then you're using the wrong tools.

    hey now, i agree with that! reduce the scope, and make all your code more block oriented... but i'm still scratching my head over the multiline varible declarations adrian... thanks just the same...

    seems to me that if you've got bulletproof code, it becomes as reliable [and hopefully as documented] as any of the standard library functions... then you take it for granted... [which is good]... how does anything besides descriptive data handles improve bulletproof code?
    hasafraggin shizigishin oppashigger...

  11. #11
    Registered User
    Join Date
    Aug 2001
    Posts
    403

    i usually use my own "semi-hungarian" notation

    I dont like some of the microsoft standards for certain things 'lpsz' for instance, but i do try to prefix my variable in larger projects. It really can help me find problems sometimes, but there is no reason to prefix every variable in every function one writes.

  12. #12
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Carlos:

    >>> Hehe, Adrianxw, what a deją-vu feeling

    Yup, seem to recall that too.

    DA:

    >>> i'm still scratching my head over the multiline varible declarations adrian

    What's the problem?

    int *a,b; // Not a problem but a potential problem

    int *a;
    int b;

    No problem. One line, one declaration.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  13. #13
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    See, but I don't agree UNLESS you're using pointers...or arrays (I just don't like the look of "arr1[20],arr2[30],arr3[40]"). like to me, something like

    int a, b, c;

    is just fine. Wastes a little less space and generally easier to type. but if you've got

    char *a, *b, c;

    that's be much better as

    char *a;
    char *b;
    char c;

    but wasn't there a thread for this SOMEwhere?

  14. #14
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    yeah, what i'm saying is a good programmer would know the conventions for single line declarations of several variables, so why not use them? the only potential problem i can see is the one you pointed out, where pointer signification is not distributed... but that's it... so... why? you'd know of it, y'know what i'm saying?
    hasafraggin shizigishin oppashigger...

  15. #15
    Peace
    Join Date
    Aug 2001
    Posts
    1,510
    I dont bother using it with variables of local scope unless they are pointers. Pointers are always pPointer. It just pakes sense. Globals (if for some strange reason i have any) are always g_pPointer or g_iInteger or whatever. Theres rarely a point in notarizing locals.

    char *a, *b, c;

    that's be much better as

    char *a;
    char *b;
    char c;
    Very much agreed. Alternatly i do this:
    Code:
    char
          *a, //with the added bonus 
          *b, //that you can describe each 
          c; //variables use after its definition
    Although i would never be caught dead using variables with names like a, b, and c but this is of course an example.
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. hungarian notation
    By KIBO in forum General Discussions
    Replies: 61
    Last Post: 01-11-2010, 11:42 PM
  2. CamelCase VS Hungarian notation, which is better?
    By meili100 in forum C++ Programming
    Replies: 4
    Last Post: 04-22-2007, 10:31 PM
  3. Hungarian Notation
    By FOOTOO in forum C Programming
    Replies: 6
    Last Post: 05-20-2005, 09:35 PM
  4. Hungarian Notation POLL
    By maxhavoc in forum A Brief History of Cprogramming.com
    Replies: 13
    Last Post: 06-21-2004, 11:52 AM
  5. hungarian notation
    By confuted in forum C++ Programming
    Replies: 2
    Last Post: 07-28-2003, 02:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21