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.
  • M Marc Clifton

    Rocky Moore wrote:

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

    NO! Marc

    Thyme In The Country

    People are just notoriously impossible. --DavidCrow
    There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
    People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith

    J Offline
    J Offline
    Josh Smith
    wrote on last edited by
    #7

    Marc Clifton wrote:

    NO!

    I think you mean _NO! :-D

    :josh: My WPF Blog[^]
    We are what we repeatedly do. Excellence then, is not an act, but a habit. - Aristotle

    1 Reply Last reply
    0
    • N Nish Nishant

      Rocky Moore wrote:

      but I had hoped to never see them again. Now much of the code released by MS has private members prefixed

      Well theoretically, you shouldn't be looking at the private members (either fields or functions), unless you are maintaining someone else's code.

      Regards, Nish


      Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
      Currently working on C++/CLI in Action for Manning Publications. (*Sample chapter available online*)

      R Offline
      R Offline
      Roger Wright
      wrote on last edited by
      #8

      Nishant Sivakumar wrote:

      you shouldn't be looking at the private members

      It's considered quite rude in my neighborhood.

      "...a photo album is like Life, but flat and stuck to pages." - Shog9

      N E 2 Replies Last reply
      0
      • R Roger Wright

        Nishant Sivakumar wrote:

        you shouldn't be looking at the private members

        It's considered quite rude in my neighborhood.

        "...a photo album is like Life, but flat and stuck to pages." - Shog9

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #9

        :laugh:

        Regards, Nish


        Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
        Currently working on C++/CLI in Action for Manning Publications. (*Sample chapter available online*)

        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!

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

          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 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
            Christian Graus
            wrote on last edited by
            #11

            avanwieren wrote:

            Isn't this part of or all of the Hungarian notation?

            No.  m_ is part of hungarian notation, but the main thing is to prefix the type as in m_hwndTheWindowHandle, m_nWindowCount.

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

            J E 2 Replies Last reply
            0
            • C Christian Graus

              avanwieren wrote:

              Isn't this part of or all of the Hungarian notation?

              No.  m_ is part of hungarian notation, but the main thing is to prefix the type as in m_hwndTheWindowHandle, m_nWindowCount.

              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
              #12

              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

              C P 2 Replies 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!

                A Offline
                A Offline
                Anders Molin
                wrote on last edited by
                #13

                _SomeVariable sucks, but I always use m_SomeVariable, both in C++ (which I fortunately still use) and in C#.

                - Anders My new photo website[^]

                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
                  Nemanja Trifunovic
                  wrote on last edited by
                  #14

                  Rocky Moore wrote:

                  I personal hate variables prefixed with with _underscores _as _it _can _make _reading _code() _a _pain!

                  I hate way too many things, but no code conventions are among them :) . Just use whatever the rest of the gang uses.


                  Programming Blog utf8-cpp

                  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

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

                    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 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
                      Not Active
                      wrote on last edited by
                      #16

                      I agree, using _ is just ugly and hard to type. Unfortunatly I'm stuck at a client right now who insists on using it. Reason? Because we've always done it that way :rolleyes:


                      only two letters away from being an asset

                      A 1 Reply Last reply
                      0
                      • R Roger Wright

                        Nishant Sivakumar wrote:

                        you shouldn't be looking at the private members

                        It's considered quite rude in my neighborhood.

                        "...a photo album is like Life, but flat and stuck to pages." - Shog9

                        E Offline
                        E Offline
                        El Corazon
                        wrote on last edited by
                        #17

                        Roger Wright wrote:

                        It's considered quite rude in my neighborhood.

                        It is the same here.... perhaps this is a southwest thing?

                        _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                        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!

                          V Offline
                          V Offline
                          Vikram A Punathambekar
                          wrote on last edited by
                          #18

                          pI vThink aHungarian nNotation vIs iA aWonderful nThing cAnd pEveryone avShould vUse pIt aAll dThe nTime, adNo nMatter pWhat dThe nContext, adEven adWhen vSpeaking. [^]

                          Cheers, Vikram.


                          "Life isn't fair, and the world is full of unscrupulous characters. There are things worth fighting for, killing for and dying for, but it's a really small list. Chalk it up to experience, let it go, and move on to the next positive experience in your life." - Christopher Duncan.

                          1 Reply Last reply
                          0
                          • 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
                                          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