469,622 Members | 1,445 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,622 developers. It's quick & easy.

why we use letter 'm' for variable decleration

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 '05 #1
6 1466
ja*****@canada.com 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!"
Sep 23 '05 #2
Thanks ag.

Sep 23 '05 #3
ja*****@canada.com 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
Sep 23 '05 #4
ja*****@canada.com 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.

Sep 23 '05 #5

<ja*****@canada.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
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
Sep 23 '05 #6
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!!!
Sep 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

134 posts views Thread by James A. Donald | last post: by
17 posts views Thread by Tapeesh | last post: by
8 posts views Thread by Mansi | last post: by
3 posts views Thread by estafford | last post: by
reply views Thread by Husam | last post: by
2 posts views Thread by Marc Miller | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.