473,405 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 1536
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
17
by: Tapeesh | last post by:
I would like to know what is the expected behaviour of C compilers when an extern decleration is intialized. When the following code is compiled using gcc //File extern.c int arr ; int a ;
8
by: Mansi | last post by:
Given the following declaration: String letter = "A"; Is there a way that I can increment letter so that "B" is returned? Is there a way that I can add an offset so that let's say, "G" is...
3
by: estafford | last post by:
Newbie looking for some insight here. I am writing a block to check limitations on a query string as follows: public bool validNumber(string qstring){ bool isValidNumber; foreach(char c in...
0
by: Husam | last post by:
Hi EveryBody: I got this decleration for function from URLMON.dll as follows: <DllImport("urlmon.dll", ExactSpelling:=True, CharSet:=CharSet.Unicode)> _ Friend Shared Function...
2
by: Marc Miller | last post by:
This is my first attempt working with Excel from vb.net. Whew! I'm trying to get the column letter so that I can create a range variable. 1. I am looping thru the sheets using : for i = 1 to...
10
by: QQ | last post by:
for instance, I read a char from the input and I need to decide whether it is a letter or a number What I am doing is char a; ...... // read a int true = false; if(( (a >='0') && (a <='9')) | |...
3
by: kasiyil | last post by:
Hello, I have a compilation problem about namespaces: I have a namespace X in which I declera a type definition: In X.h file i write: namespace X { typedef unsigned int WindowHandle_t; }
4
by: yash0101 | last post by:
I have a hash , and in the value part of that (which is a string , So that variable interpolation can happen) i have used a variable . Now later in the program i set this variable and try to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.