Actually, I adopted most of how Stroustrup codes. I like it, it's compact and clear (although, I don't put braces on the same line when using C++ because things like initializer lists are too common and becomes confusing).
Since this thread is off topic anyway I want to come back to something someone posted very early in this discussion: Placement of the asterisk in pointer declaration.
I just recently taught a colleague some C++ and I stumbled upon his question why I put the '*' next to the type name, like:
int* pCnt;
My explanation was: 'pCnt' is the "identifier" and it has the type "pointer to integer", therefore: 'int*'.
I always thought it was logical, but people seem to prefer:
int *pCnt;
How do you explain that? '*pCnt' is the "identifier that is a pointer" and it has the type "integer"?
How do you explain that? '*pCnt' is the "identifier that is a pointer" and it has the type "integer"?
1 2 3 4
int* ptr_1; // ptr_1 is a variable of type pointer to an integer
int *ptr_2; // ptr_2 is a variable of type pointer to an integer
int * ptr_3; // ptr_3 is a variable of type pointer to an integer
int*ptr_4; // ptr_4 is a variable of type pointer to an integer
In reality I think it really doesn't matter because most programmers won't get confused by the asterisk being by the type or the other way around. Only beginners might be confused about it when they are just getting familiar with the syntax.
So it basically comes down to personal preference (IE Whatever you like the look of more, or what makes more sense to you), or your projects coding standards if you are working in a group.
So if you put it like this int* p1; or like this int *p1; it really doesn't matter to me.
I think there is much more serious things in C++ then where we put out asterisks on pointers. For example why the hell aren't they using @ for the reference operator ;p
And has anyone realize Bjarne's coding style is godawful?
I think it's a little ridiculous when a nube like Fredbill is calling Bjarnes style godawful.
And Vlad thinks people stupidly follow "well known idiots like Bjarnes", and adopt bad styling choices like using bracket on starting line. That's pretty ridiculous considering that blindly following Vlad's non-existent logical argument why it's bad would be even stupider.
But what is really ridiculous is that somehow people think this is an important issue, as if your code will be cleaner and prettier in an objective way using a, or b; especially when it comes from nubes who write horribly inelegant/ugly code anyways.
I havent developed the eyes to spot a professionals coding style as being god awful.
It could be perfection itself but people repeat this shit to sound like they know what they are talking about, even professionals with many years experience.
I would not be surprized at all if Bjarne's style of coding is terrible. He has no need to prove himself nor impress anyone.
I try like hell to code in such a way that a beginner could follow my logic, but should Bjarne? He could very well be like, screw you and just try to keep up, and we'd all eat it. He is the man after all.