Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Hungarian Notation vs. IntelliSense

Hungarian Notation vs. IntelliSense

Scheduled Pinned Locked Moved The Lounge
c++visual-studioalgorithmsquestion
33 Posts 21 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Henry Jacobs

    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.

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #5

    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.

    A S 2 Replies Last reply
    0
    • H Henry Jacobs

      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.

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #6

      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

      J 1 Reply Last reply
      0
      • H Henry Jacobs

        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.

        H Offline
        H Offline
        Henrik Husted
        wrote on last edited by
        #7

        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 :)

        1 Reply Last reply
        0
        • H Henry Jacobs

          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.

          B Offline
          B Offline
          Bao Nguyen
          wrote on last edited by
          #8

          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.

          1 Reply Last reply
          0
          • C Christian Graus

            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.

            A Offline
            A Offline
            Andrew Peace
            wrote on last edited by
            #9

            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.

            C J 2 Replies Last reply
            0
            • H Henry Jacobs

              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.

              C Offline
              C Offline
              Chris Maunder
              wrote on last edited by
              #10

              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

              P J M 3 Replies Last reply
              0
              • A Andrew Peace

                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.

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #11

                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.

                T 1 Reply Last reply
                0
                • C Chris Maunder

                  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

                  P Offline
                  P Offline
                  Pavlos Touboulidis
                  wrote on last edited by
                  #12

                  ... 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|

                  S 1 Reply Last reply
                  0
                  • H Henry Jacobs

                    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.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #13

                    Uh, yes. What is your intended purpose of your question?

                    1 Reply Last reply
                    0
                    • H Henry Jacobs

                      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.

                      M Offline
                      M Offline
                      Michael A Barnhart
                      wrote on last edited by
                      #14

                      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.

                      1 Reply Last reply
                      0
                      • C Chris Maunder

                        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

                        J Offline
                        J Offline
                        Jonathan Gilligan
                        wrote on last edited by
                        #15

                        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.
                        }

                        J 1 Reply Last reply
                        0
                        • H Henry Jacobs

                          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.

                          J Offline
                          J Offline
                          Jonathan Gilligan
                          wrote on last edited by
                          #16

                          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 use m_, 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? :-)).

                          H 1 Reply Last reply
                          0
                          • A Andrew Peace

                            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.

                            J Offline
                            J Offline
                            James Pullicino
                            wrote on last edited by
                            #17

                            Same here.

                            1 Reply Last reply
                            0
                            • J Jonathan Gilligan

                              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.
                              }

                              J Offline
                              J Offline
                              James Pullicino
                              wrote on last edited by
                              #18

                              Parameters are local variables.

                              J 1 Reply Last reply
                              0
                              • H Henry Jacobs

                                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.

                                S Offline
                                S Offline
                                Simon Brown
                                wrote on last edited by
                                #19

                                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

                                1 Reply Last reply
                                0
                                • C Christian Graus

                                  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.

                                  S Offline
                                  S Offline
                                  Simon Brown
                                  wrote on last edited by
                                  #20

                                  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

                                  1 Reply Last reply
                                  0
                                  • P Pavlos Touboulidis

                                    ... 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|

                                    S Offline
                                    S Offline
                                    Simon Brown
                                    wrote on last edited by
                                    #21

                                    What I hate the most is the Win32 typedefs like: LPCTSTR, LPTSTR, LPxxx etc. Why? They are obvious? Old Simon

                                    S 1 Reply Last reply
                                    0
                                    • T Tim Deveaux

                                      I think Mike Dunn wrote a shell extension for that. :-D

                                      A Offline
                                      A Offline
                                      Anna Jayne Metcalfe
                                      wrote on last edited by
                                      #22

                                      What more can I say but... ROFL! ;P Andy Metcalfe - Sonardyne International Ltd
                                      (andy.metcalfe@lineone.net)
                                      http://www.resorg.co.uk

                                      "I used to be a medieval re-enactor, but I'm (nearly) alright now..."

                                      1 Reply Last reply
                                      0
                                      • S Simon Brown

                                        What I hate the most is the Win32 typedefs like: LPCTSTR, LPTSTR, LPxxx etc. Why? They are obvious? Old Simon

                                        S Offline
                                        S Offline
                                        Simon Capewell
                                        wrote on last edited by
                                        #23

                                        The L is the annoying bit for me, since it's a legacy thing from 16 bit days. Of cource you could argue that it'll have a second wind with win64...

                                        A 1 Reply Last reply
                                        0
                                        • S Simon Capewell

                                          The L is the annoying bit for me, since it's a legacy thing from 16 bit days. Of cource you could argue that it'll have a second wind with win64...

                                          A Offline
                                          A Offline
                                          Anna Jayne Metcalfe
                                          wrote on last edited by
                                          #24

                                          I dropped the "l" prefix when I started with VC 4.0. Most of the others still make sense though I do get irritated that Win32 and MFC use different prefixes! Andy Metcalfe - Sonardyne International Ltd
                                          (andy.metcalfe@lineone.net)
                                          http://www.resorg.co.uk

                                          "I used to be a medieval re-enactor, but I'm (nearly) alright now..."

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups