why we use letter 'm' for variable decleration

J

jamilsh

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

Artie Gold

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
 
V

Victor Bazarov

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
 
J

Jaspreet

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

Mike Wahler

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
 
P

Phlip

jamilsh said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top