why we use letter 'm' for variable decleration

Discussion in 'C++' started by jamilsh@canada.com, Sep 23, 2005.

  1. Guest

    I have seen lot of C/C++ code but couldn't understand why we use letter
    'm' with lot of variable declaration. See example below.

    private:
    static NXTSTRUCT_t mTaGat;
    static DDXYZSTRUCT_t mEditGat;


    Thanks,

    C/C++ student.
    , Sep 23, 2005
    #1
    1. Advertising

  2. Artie Gold Guest

    wrote:
    > I have seen lot of C/C++ code but couldn't understand why we use letter
    > 'm' with lot of variable declaration. See example below.
    >
    > private:
    > static NXTSTRUCT_t mTaGat;
    > static DDXYZSTRUCT_t mEditGat;
    >
    >
    > Thanks,
    >
    > C/C++ student.
    >

    It indicates that it's a member variable. Personally I find it ugly. YMMV.

    HTH,
    --ag

    --
    Artie Gold -- Austin, Texas
    http://goldsays.blogspot.com (new post 8/5)
    http://www.cafepress.com/goldsays
    "If you have nothing to hide, you're not trying!"
    Artie Gold, Sep 23, 2005
    #2
    1. Advertising

  3. Guest

    Thanks ag.
    , Sep 23, 2005
    #3
  4. wrote:
    > I have seen lot of C/C++ code but couldn't understand why we use letter
    > 'm' with lot of variable declaration. See example below.
    >
    > private:
    > static NXTSTRUCT_t mTaGat;
    > static DDXYZSTRUCT_t mEditGat;


    For the same reason the letters "_t" are in the types.

    V
    Victor Bazarov, Sep 23, 2005
    #4
  5. Jaspreet Guest

    wrote:
    > I have seen lot of C/C++ code but couldn't understand why we use letter
    > 'm' with lot of variable declaration. See example below.
    >
    > private:
    > static NXTSTRUCT_t mTaGat;
    > static DDXYZSTRUCT_t mEditGat;
    >
    >
    > Thanks,
    >
    > C/C++ student.


    m is for member variable of a class or a structure.
    Jaspreet, Sep 23, 2005
    #5
  6. Mike Wahler Guest

    <> wrote in message
    news:...
    >I have seen lot of C/C++ code but couldn't understand why we use letter
    > 'm' with lot of variable declaration. See example below.
    >
    > private:
    > static NXTSTRUCT_t mTaGat;
    > static DDXYZSTRUCT_t mEditGat;
    >
    >
    > Thanks,
    >
    > C/C++ student.


    There's no requirement by the language that this be done,
    but it could be part of a business' coding standards, and
    some folks adopt it as their personal 'style', ('m' used
    to denote 'member' (of a class) ).

    It's a 'style' issue.

    -Mike
    Mike Wahler, Sep 23, 2005
    #6
  7. Phlip Guest

    jamilsh wrote:

    > private:
    > static NXTSTRUCT_t mTaGat;
    > static DDXYZSTRUCT_t mEditGat;


    Those are incorrect because m_ should denote a member. ("Should" applies
    when your team or teacher decide which decorations they want to use for a
    given project.)

    They should be sm_, for Static Member. Other variations:

    g_ global
    s_ file static
    s or str string
    p pointer
    a or the reference

    These are _not_ Hungarian Notation, which Google can easily tell you why it
    sucks, so PLEEEEZE don't start a thread.

    --
    Phlip
    http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
    Phlip, Sep 23, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vertigo

    big letter -> small letter

    vertigo, Jul 6, 2004, in forum: Python
    Replies:
    4
    Views:
    744
    Reinhold Birkenfeld
    Jul 6, 2004
  2. Tony Meyer

    RE: big letter -> small letter

    Tony Meyer, Jul 6, 2004, in forum: Python
    Replies:
    0
    Views:
    491
    Tony Meyer
    Jul 6, 2004
  3. Andrew McNamara

    Re: big letter -> small letter

    Andrew McNamara, Jul 6, 2004, in forum: Python
    Replies:
    2
    Views:
    739
    Scott David Daniels
    Jul 6, 2004
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,733
    Smokey Grindel
    Dec 2, 2006
  5. Arthur J. O'Dwyer

    Re: Why (or not) use single letter variable names?

    Arthur J. O'Dwyer, Dec 18, 2004, in forum: C Programming
    Replies:
    7
    Views:
    334
    Arthur J. O'Dwyer
    Dec 20, 2004
Loading...

Share This Page