That's very presumptous of you to say considering that personal coding style is a religious issue. Personally, I do not do all that you have commanded.most CBoard members will prefer what I suggested as coding style
That's very presumptous of you to say considering that personal coding style is a religious issue. Personally, I do not do all that you have commanded.most CBoard members will prefer what I suggested as coding style
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
> Should we create a poll to find out the most popular style?
No.
Or should I say, nO or n_o or whatever else.
No. Refer to the existing coding style polls to find out why such a poll is useless.Should we create a poll to find out the most popular style?
Since you are so curious, the naming convention is that part of my personal coding style can be summarised as:If you do not happen to use such style, then what is your style?
functionName
TypeName
NamedConstant
variable_name
MACRO_NAME
Although names beginning with an underscore followed by a non-uppercase letter are only reserved to the implementation for use in the global and std namespace, I still suggest that an underscore suffix be used instead of a prefix if one wishes to decorate member variable names with an underscore. I consider this more generally consistent.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Well ... leave it then.
That is pretty strange and inconsistent style. Do you find difficulty differentiating between variables and functions? And why you do not use the standard practice among all the languages of using all caps for constants?Since you are so curious, the naming convention is that part of my personal coding style can be summarised as:
functionName
TypeName
NamedConstant
variable_name
MACRO_NAME
> That is pretty strange and inconsistent style.
It's only inconsistant if you don't stick to it. How can a set of guidelines be inconsistant!?
> And why you do not use the standard practice among all the languages of using all caps for constants?
Since when is that standard!?
You know, differentiating styles for different types (functions, variables, constants), makes it easier to identify what type of something you are referring to.
I tend more usually to use a few styles and identifiers:
FunctionName (or sometimes function_name to match those functions available in STL - begin, end, resize, capacity, etc).
TypeName_t
NAMED_CONSTANT
VariableName OR variable_name (typically with a prefix for type such as "p" for pointer, "r" for reference, "str" for string, etc).
MACRO_NAME
Just to be a little more explicit:
- Inconsistent within itself. Function names and variable names look different for not reasons known to me. I had asked him. Let him reply first.
- Inconsistent compared to standard conventions, consts are not all caps.
- No difference in eg. a class name and a named constant naming.
> Inconsistent compared to standard conventions
No such thing.
> Function names and variable names look different for not reasons known to me.
And they should be. How do you know what a function is and what a variable is otherwise?
Pointless.
Insanely pointless.> Function names and variable names look different for not reasons known to me.
And they should be. How do you know what a function is and what a variable is otherwise?
I wonder you write it like this then,
Code:void FUNCTION_computeSalary() {} double VARIABLE_balance;
Oh really? I'd say it's quite necessary.
Looking over some old source, I found a variable and thought "where the heck did this come from?" because it didn't seem to be defined within the scope of the function. Do I really have to be that confused? Of course not.
That's why it's good to make differentiation between different things. Like prefix member variables with m_ and global variables with g_ and separate variables and functions.
Is this another of your "it's arrogant" belief?
Defense's argument is mis leading for the court
Elysia what you said is right. But do you use different name styles, just so that, not to confuse between variables and functions? Highly unbelievable!
Not at all. I only find First letter capitalized type names arrogant, except when used for class names etc.Is this another of your "it's arrogant" belief?
I don't find it unbelievable. The reason I don't do it is because I don't really feel the need to do so. That doesn't mean others do. And my general style is just "MyFunction" and "MyVariable" - ie, the same. But I have been known to lower case both functions and variables at times. I just don't really have any other naming style to apply to functions.
Well zacs and laser are out of it already. Not to stretch any further myself. And Elysia has good points also.
I would just sum up, saying, I find it rather pointless to worry too much, about naming schemes. For me, a better naming scheme is, in which, identifier names are closer to their real worlds names.
eg:
humansCount / humans_count is easier to read
than
nHumansCount or m_nHumansCount etc.
Generally, I do not have difficulty differentiating between syntactic elements after viewing them in context, regardless of the naming convention. If you cannot do that... it would be tough to be a programmer, or even a reader of novels.Do you find difficulty differentiating between variables and functions?
Recall that C++ has function pointers. Aside from that, I find that it helps me mentally remember the functions and variables. As a secondary reason, it increases the number of possible names in the given scope.Inconsistent within itself. Function names and variable names look different for not reasons known to me.
Macro names do not obey the rules of scope. Consequently, Stroustrup, Meyers, Sutter and Alexandrescu all recommend reserving fully capitalised names for macros.Inconsistent compared to standard conventions, consts are not all caps.
I do not see a problem since named constants are usually within namespace or class scope.No difference in eg. a class name and a named constant naming.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)