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. What do you think?

What do you think?

Scheduled Pinned Locked Moved The Lounge
questiondatabasesql-servercomsysadmin
94 Posts 67 Posters 0 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.
  • C Christian Graus

    I don't like m_, and I need to use _ in order to write code that is CLS compliant ( because VB sucks ). Having a private variable that has a totally different name to the public property is just untenable.

    Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

    R Offline
    R Offline
    Rocky Moore
    wrote on last edited by
    #19

    As long as you keep it in VB everyone should be happy :)

    Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

    1 Reply Last reply
    0
    • C Christian Graus

      Didn't Josh do that joke above ?

      Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

      J Offline
      J Offline
      JimmyRopes
      wrote on last edited by
      #20

      _SomethingLikeIt

      Simply Elegant Designs JimmyRopes Designs
      Think inside the box! ProActive Secure Systems
      I'm on-line therefore I am. JimmyRopes

      1 Reply Last reply
      0
      • R Rocky Moore

        Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

        Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

        T Offline
        T Offline
        Taka Muraoka
        wrote on last edited by
        #21

        Rocky Moore wrote:

        Do you use/like the "_" to prefix private members?

        IIRC, symbols with a leading _ are reserved for the system. This is for C but probably carried over to C++, although it probably doesn't apply for class members. It'd be dumb to use them, though, quite apart from the fact it looks butt-ugly. I always used to use "m_" for member variables and hated it, until I had an epiphany and saw someone using just "m" (e.g. mMemberVariable). So much nicer :cool:


        0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall. Awasu 2.2.4 [^]: A free RSS/Atom feed reader with support for Code Project.

        M 1 Reply Last reply
        0
        • R Rocky Moore

          Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

          Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

          Steve EcholsS Offline
          Steve EcholsS Offline
          Steve Echols
          wrote on last edited by
          #22

          I tend to adapt to the convention of the framework I'm writing it in. For MFC/ATL it was m_. I've been using the VCF recently and most member vars are post fixed with "_", like window_. Took some getting used, to but it actually adds a bit of whitespace, so it almost makes things more readable. If you want to be able to read code like it was a novel, become a member of the Osmosian Order. :laugh::laugh::laugh: (Sorry, couldn't resist) Anyway, the older I get the more whitespace I need to make the code more readable, so I tend to like the underscores. JMHO.


          - S 50 cups of coffee and you know it's on!

          • S
            50 cups of coffee and you know it's on!
            Code, follow, or get out of the way.
          1 Reply Last reply
          0
          • R Rocky Moore

            Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

            Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

            N Offline
            N Offline
            Nirosh
            wrote on last edited by
            #23

            Some kind of a prefix is good since it will group the members with the same access level together in the tool tip, provided by the IDE.

            L.W.C. Nirosh. Colombo, Sri Lanka.

            1 Reply Last reply
            0
            • R Rocky Moore

              Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

              Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

              M Offline
              M Offline
              Mohamed Meligy
              wrote on last edited by
              #24

              I use - Pascal casing with "_" prefix for proivate members. - Pascal casing for local variables. - Camel casing for public properties, and all methods. This is meant to make reading code "easier". It's also Mirosoft naming BTW, you can find it in the class library developer guidance. Mohamed Ahmed Meligy Software Engineer SilverKey.us[^] - Egypt Branch http://GeeksWithBlogs.NET/Mohamed[^] -- modified at 0:42 Tuesday 16th January, 2007

              A 1 Reply Last reply
              0
              • R Rocky Moore

                Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                H Offline
                H Offline
                hswear3
                wrote on last edited by
                #25

                Personally I also hate underscores. And so does FxCop! Since according to Microsoft guidelines local parameters should be camel-cased, I use Pascal case for class members. So, instead of "mVariable" or "m_Variable" or "_Variable", I simply use "Variable." Herb :)

                Herbert N Swearengen III

                1 Reply Last reply
                0
                • R Rocky Moore

                  Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                  Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                  M Offline
                  M Offline
                  Michael P Butler
                  wrote on last edited by
                  #26

                  Rocky Moore wrote:

                  Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                  I do in my .NET code. All my class member variables are _ prefixed. Of course most of the time, I access them via Properties rather than directly using the variable. I can't remembered why I moved to _ prefix. It was either because FxCop whined about it or because of some VB issue. In C++, I used m_ so the _prefix is kind of keeping up a long tradition.

                  Michael CP Blog [^] Development Blog [^]

                  R 1 Reply Last reply
                  0
                  • R Rocky Moore

                    Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                    Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                    M Offline
                    M Offline
                    Mustafa Ismail Mustafa
                    wrote on last edited by
                    #27

                    I use pascal notation with an "_" for the private members. Picked up the habit at from my uncle ( he was a crack shot C coder working for ComputerVision out of Mass.) and I kept with it. It actually improves readability.

                    There are 10 kinds of people in this world. Those who understand binary and those who don't... ______________________ Its the idiot who stops learning and the wise that keep asking you questions!!!! ______________________ "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

                    1 Reply Last reply
                    0
                    • R Rocky Moore

                      Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                      Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                      S Offline
                      S Offline
                      Stick
                      wrote on last edited by
                      #28

                      Isn't there a saying, "When in Windows, do as Microsoft?" I use m_ mainly as it groups all the member vars together in my suggestions box, however with VA X, if I didn't, I could just click to display only the private members or whatever. But it saves me a click. Read a good discussion about it in Code Complete 2nd Edition. Patrick

                      D 1 Reply Last reply
                      0
                      • R Rocky Moore

                        Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                        Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                        T Offline
                        T Offline
                        Tim Craig
                        wrote on last edited by
                        #29

                        No! And I don't like seeing it on members in public either. ;P

                        The evolution of the human genome is too important to be left to chance idiots like CSS.

                        J 1 Reply Last reply
                        0
                        • S Stick

                          Isn't there a saying, "When in Windows, do as Microsoft?" I use m_ mainly as it groups all the member vars together in my suggestions box, however with VA X, if I didn't, I could just click to display only the private members or whatever. But it saves me a click. Read a good discussion about it in Code Complete 2nd Edition. Patrick

                          D Offline
                          D Offline
                          DavidNohejl
                          wrote on last edited by
                          #30

                          Stick^ wrote:

                          Read a good discussion about it in Code Complete 2nd Edition.

                          I didn't get there yet, but yesterday I read capitol where is suggested that it might be good idea to prefix input parameters with i_, output parameters by o_ and parameters that will be modified by.... m_ ! :wtf:


                          "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus

                          S 1 Reply Last reply
                          0
                          • R Rocky Moore

                            Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                            Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                            B Offline
                            B Offline
                            Bruce Chapman DNN
                            wrote on last edited by
                            #31

                            I think like flared jeans and miniskirts, all fads have their time in the sun more than once. You can either sit on your high horse and declare all those around you to be of inferior quality, or you can join in the fun and just go with the flow. I used to adjHungarian nounEverything, nounNow nounIt vrbDrives pronounMe vrbInsane. (please no comments on grammar, i've no idea on sentence structure) I've gotten used to using _memberVar. It's handy because it allows you to use the same var twice in the one procedure, one for an incoming local value, and one for the _member version. I suspect in three years I'll be doing a global 'find/replace' on the _ character. To whatever is in fashion then. How else can you feel nostalgic looking at old code??

                            Bruce Chapman iFinity.com.au - Websites and Software Development Plithy remark available in Beta 2

                            1 Reply Last reply
                            0
                            • R Rocky Moore

                              Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                              Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                              S Offline
                              S Offline
                              Stuart Dootson
                              wrote on last edited by
                              #32

                              I use '_' as a suffix for private member data (which means either all member data of a class or none of it) in C++. However, the rest of the naming is camel-case (capitalized for functions and classes):

                              class SampleClass
                              {
                              public:
                                 int SomeMethod() const;
                              private:
                                 int aDataMember_;
                              };
                              
                              R 1 Reply Last reply
                              0
                              • A Aaron VanWieren

                                Can't stand _them. Sorry to butt in on this, but this is one thing I truly hate. Isn't this part of or all of the Hungarian notation? Which has historical roots in early programming?

                                C Offline
                                C Offline
                                Chris_Green
                                wrote on last edited by
                                #33

                                You'll love this: I use both, but consistently. Any variable which belong in the header file is prefixed with m_ Any control is prefixed with _TypeDescriptor such as _EditTest or _ButtonGo. It does make working with the code, especially via IntelliSense, remarkably easy. All the variables are nicely grouped. And all the controls are grouped separately and sorted by type.

                                1 Reply Last reply
                                0
                                • J JimmyRopes

                                  Christian Graus wrote:

                                  No

                                  Did you mean strNo? :~

                                  Simply Elegant Designs JimmyRopes Designs
                                  Think inside the box! ProActive Secure Systems
                                  I'm on-line therefore I am. JimmyRopes

                                  P Offline
                                  P Offline
                                  Pete OHanlon
                                  wrote on last edited by
                                  #34

                                  JimmyRopes wrote:

                                  Did you mean strNo?

                                  Surely it's lpszNo.

                                  the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
                                  Deja View - the feeling that you've seen this post before.

                                  1 Reply Last reply
                                  0
                                  • J Jorgen Sigvardsson

                                    Rocky Moore wrote:

                                    So, what you think?

                                    Personally, I like the m_ prefix. But I can deal with pretty much anything, as long as it's consistent.

                                    -- Not based on the Novel by James Fenimore Cooper

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

                                    Same here.

                                    The tigress is here :-D

                                    1 Reply Last reply
                                    0
                                    • R Rocky Moore

                                      Well, since John Simmons got his new TV, he probably will be missing for about two days, but for the rest of you: It has been around two years I think since I have asked this question and I am curious as to if people have changed their minds. Do you use/like the "_" to prefix private members? I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain! In the old days of Assembler and some C code, we lived with it all the time, but I had hoped to never see them again. Now much of the code released by MS has private members prefixed. So, what you think?

                                      Rocky <>< Latest Code Blog Post: SQL Server Express Warnings & Tips Latest Tech Blog Post: Microsoft doing it again!

                                      B Offline
                                      B Offline
                                      Bogdan Damian
                                      wrote on last edited by
                                      #36

                                      I use it only this notation for private vars from classes :)

                                      damianbc Developer

                                      1 Reply Last reply
                                      0
                                      • T Tim Craig

                                        No! And I don't like seeing it on members in public either. ;P

                                        The evolution of the human genome is too important to be left to chance idiots like CSS.

                                        J Offline
                                        J Offline
                                        Jorgen Sigvardsson
                                        wrote on last edited by
                                        #37

                                        Tim Craig wrote:

                                        The evolution of the human genome is too important to be left to chance idiots like CSS.

                                        Does that qualify as meta-evolution? :)

                                        -- Verletzen zerfetzen zersetzen zerstören Doch es darf nicht mir gehören Ich muss zerstören

                                        1 Reply Last reply
                                        0
                                        • T Taka Muraoka

                                          Rocky Moore wrote:

                                          Do you use/like the "_" to prefix private members?

                                          IIRC, symbols with a leading _ are reserved for the system. This is for C but probably carried over to C++, although it probably doesn't apply for class members. It'd be dumb to use them, though, quite apart from the fact it looks butt-ugly. I always used to use "m_" for member variables and hated it, until I had an epiphany and saw someone using just "m" (e.g. mMemberVariable). So much nicer :cool:


                                          0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall. Awasu 2.2.4 [^]: A free RSS/Atom feed reader with support for Code Project.

                                          M Offline
                                          M Offline
                                          Mike Dimmick
                                          wrote on last edited by
                                          #38

                                          Various C++ authors suggest using a trailing underscore for a member variable, but that's even worse, IMO - especially when it's a pointer, since you have to release Shift in order to dereference (to type the '-' of ->).

                                          Stability. What an interesting concept. -- Chris Maunder

                                          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