473,396 Members | 1,966 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,396 software developers and data experts.

About conventions : "m_"


I've notice that some Microsoft's code, uses the "m_" convention to refer t
private member fields
Check this
http://support.microsoft.com/default...kb;EN-US;32608
http://support.microsoft.com/default...kb;EN-US;32617
http://support.microsoft.com/default...kb;EN-US;32614

I read the dotnet guidelines, and I don't recall the "m_" convention wa
accepted

Is Microsoft violating its own code rules

Regards
Nov 15 '05 #1
4 5756
Craig Kenisston <cr************@hotmail.com> wrote:

I've notice that some Microsoft's code, uses the "m_" convention to refer to
private member fields.
Check this :
http://support.microsoft.com/default...b;EN-US;326080
http://support.microsoft.com/default...b;EN-US;326176
http://support.microsoft.com/default...b;EN-US;326145

I read the dotnet guidelines, and I don't recall the "m_" convention was
accepted.

Is Microsoft violating its own code rules ?
I think so.

I've seen other instances of convention violation in .NET sample code
in MSDN, too:

- Using '_' as a prefix for member variable names.
- Using capitals and underscores for constant names -
THIS_IS_A_CONSTANT.

Personally, I don't use a prefix for member variable names in C#/.NET.
I used to in Delphi/VCL and C++/MFC, though.
Regards,

Nov 15 '05 #2
I use the "m_" just because they are private, you don't see it when you use
my class, don't you? And I did that because I need a clue to make the
difference between a parameter and private variable, and I don't like to use
"this" all the time to access the private data.

Best regards,
Relu

"Craig Kenisston" <cr************@hotmail.com> wrote in message
news:76**********************************@microsof t.com...

I've notice that some Microsoft's code, uses the "m_" convention to refer to private member fields.
Check this :
http://support.microsoft.com/default...b;EN-US;326080
http://support.microsoft.com/default...b;EN-US;326176
http://support.microsoft.com/default...b;EN-US;326145

I read the dotnet guidelines, and I don't recall the "m_" convention was
accepted.

Is Microsoft violating its own code rules ?
Regards,

Nov 15 '05 #3
just use _ as the m prefix is a waste of time, ofcourse its a member if
its in the type.
"Georgescu Aurelian" <re**@itprovision.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
I use the "m_" just because they are private, you don't see it when you use my class, don't you? And I did that because I need a clue to make the
difference between a parameter and private variable, and I don't like to use "this" all the time to access the private data.

Best regards,
Relu

"Craig Kenisston" <cr************@hotmail.com> wrote in message
news:76**********************************@microsof t.com...

I've notice that some Microsoft's code, uses the "m_" convention to
refer to
private member fields.
Check this :
http://support.microsoft.com/default...b;EN-US;326080
http://support.microsoft.com/default...b;EN-US;326176
http://support.microsoft.com/default...b;EN-US;326145

I read the dotnet guidelines, and I don't recall the "m_" convention was
accepted.

Is Microsoft violating its own code rules ?
Regards,


Nov 15 '05 #4
I think you are right, they are inconsistent:

"Do not apply a prefix to field names or static field names." - bottom of
http://tinyurl.com/519n

Personally I think the readability gained by prefixes-on-fields is worth the
pain (if you can call typing "m_" pain). Some people put "this." on front
of all members usages, but the compiler won't tell you if you forget one.
After trying "_" for a while, I still prefer "m_", cause it stands out
better.
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: BJörn Lindqvist | last post by:
I think it would be cool if you could refer to instance variables without prefixing with "self." I know noone else thinks like me so Python will never be changed, but maybe you can already do it...
26
by: Fernando M. | last post by:
Hi, i was just wondering about the need to put "self" as the first parameter in every method a class has because, if it's always needed, why the obligation to write it? couldn't it be implicit?...
10
by: Vinod I | last post by:
Hi Team, I just want to know, wat is the relevance /or benefit of using "_" before a variable. i.e., if I use a variable as "_MyVariable", wat benefit I am going to achieve than just using...
6
by: Anders Borum | last post by:
Hello! I'm wondering what the recommendations are for using the "this" keyword? The problem is that I really like to use the "this" keyword, but it tends to make the code more verbose (which...
5
by: Agnes | last post by:
For my own practices. I like to put "Me". e.g IF Me.txtInvoice.textlength = 0 ....... etc Me.txt.....etc However, Is there any difference (without Me) ?? Thanks
4
by: J.M. | last post by:
I have a question concerning inheritance: can an abstract (parent) class have an abstract object? I would like to make a concrete child inherit from this class by inheriting from this object. Let...
60
by: Dave | last post by:
I'm never quite sure whether to use "this." or not when referring to fields or properties in the same class. It obviously works just fine without it but sometimes I wonder if using this....
8
by: Internet User | last post by:
I see m_ prefixed in front of variable names all the time in code for classes. Is this a coding convention and if so how does one describe the type of variables it is used with? Thanks in...
3
by: prix prad | last post by:
Hi All, I encountered the above error when I tried to expand a macro as follows: #define EXPAND(array) int M_ ## array The problem occurs when we have 'array' itself as a macro: say...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.