Click here to Skip to main content
15,906,567 members

Survey Results

Coding style: How do you name your local variables?   [Edit]

Survey period: 3 Apr 2006 to 9 Apr 2006

What's your convention de jour for your locals?

OptionVotes% 
Pascal Cased17110.56
camel Cased70243.36
Fixed letter prefix (eg lLocal)815.00
Hungarian prefix (eg strLocal)48229.77
Scope prefix (eg l_Local)362.22
Scope and Hungarian prefix (eg l_strLocal)1257.72

View optional text answers (100 answers)


 
GeneralRe: what, no m_??? Pin
Marc Clifton3-Apr-06 2:16
mvaMarc Clifton3-Apr-06 2:16 
GeneralRe: what, no m_??? Pin
Carsten Zeumer3-Apr-06 3:21
Carsten Zeumer3-Apr-06 3:21 
GeneralRe: what, no m_??? Pin
Marc Clifton3-Apr-06 3:35
mvaMarc Clifton3-Apr-06 3:35 
GeneralRe: what, no m_??? Pin
Chris Maunder3-Apr-06 3:32
cofounderChris Maunder3-Apr-06 3:32 
GeneralRe: what, no m_??? Pin
Furty4-Apr-06 13:31
Furty4-Apr-06 13:31 
GeneralRe: what, no m_??? Pin
Gary R. Wheeler3-Apr-06 2:33
Gary R. Wheeler3-Apr-06 2:33 
GeneralRe: what, no m_??? Pin
Ravi Bhavnani3-Apr-06 6:47
professionalRavi Bhavnani3-Apr-06 6:47 
GeneralHungarian prefix (usually) Pin
Rob Caldecott3-Apr-06 0:37
Rob Caldecott3-Apr-06 0:37 
I have been using Hungarian notation since I started programming for Windows 15 years ago. However, I sometimes experiment with different styles for code that no-one else needs to maintain. For example, I always use member Get/Set functions to access class variables, which are nearly always private, so, IMHO, as long as the member variable has a sensible name, there is a good argument for dispensing with Hungarian notation altogether. In some of my classes I have even switched from prefixing all my member variables with m_ to instead using a _ suffix, e.g.:

From:

std::wstring m_strName;


To:

std::wstring name_;


If someone else is going to use the class, ALL access to name_ is via methods. However, if someone else were to come along and maintain my code, then they might not like this naming convention. We have no rules for this here - it is up to the individual - and as many of the guys here are Unix programmers, where Hungarian notation is virtually unknown - forcing them to use it would be counter-productive.

Interestingly, I am doing a Java course at the moment, which tells you to use camel notation, but shys away from any Hungarian-style notation - again, it says you should just use a sensible name for the variable.
Generala mixture, depending on the need and if it helps Pin
feline_dracoform2-Apr-06 23:51
feline_dracoform2-Apr-06 23:51 
GeneralRe: a mixture, depending on the need and if it helps Pin
Rob Caldecott3-Apr-06 0:40
Rob Caldecott3-Apr-06 0:40 
GeneralRe: a mixture, depending on the need and if it helps Pin
feline_dracoform3-Apr-06 8:52
feline_dracoform3-Apr-06 8:52 
GeneralRe: a mixture, depending on the need and if it helps Pin
Kevin McFarlane3-Apr-06 10:23
Kevin McFarlane3-Apr-06 10:23 
GeneralRe: a mixture, depending on the need and if it helps Pin
Ryan Roberts3-Apr-06 4:30
Ryan Roberts3-Apr-06 4:30 
GeneralRe: a mixture, depending on the need and if it helps Pin
feline_dracoform3-Apr-06 8:54
feline_dracoform3-Apr-06 8:54 
GeneralcamelCasing or Hungarian Pin
HimaBindu Vejella2-Apr-06 22:47
HimaBindu Vejella2-Apr-06 22:47 
GeneralAnother choice Pin
WayneMJ2-Apr-06 21:54
WayneMJ2-Apr-06 21:54 
GeneralRe: Another choice Pin
Colin Angus Mackay2-Apr-06 23:00
Colin Angus Mackay2-Apr-06 23:00 
GeneralRe: Another choice Pin
WayneMJ3-Apr-06 17:01
WayneMJ3-Apr-06 17:01 
GeneralRe: Another choice Pin
Corinna John3-Apr-06 2:22
Corinna John3-Apr-06 2:22 
Generalwhat does 'camel cased' stands for? Pin
Ștefan-Mihai MOGA2-Apr-06 20:49
professionalȘtefan-Mihai MOGA2-Apr-06 20:49 
GeneralRe: what does 'camel cased' stands for? Pin
Colin Angus Mackay2-Apr-06 20:53
Colin Angus Mackay2-Apr-06 20:53 
GeneralMore syles... Pin
Dario Solera2-Apr-06 20:30
Dario Solera2-Apr-06 20:30 
GeneralRe: More syles... Pin
Kevin McFarlane3-Apr-06 10:18
Kevin McFarlane3-Apr-06 10:18 
GeneralRe: More syles... Pin
Furty3-Apr-06 14:10
Furty3-Apr-06 14:10 
JokeDepends on the language Pin
Michael P Butler2-Apr-06 20:03
Michael P Butler2-Apr-06 20:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.