|
This is exactly how we code where I am employed. Take the default VS install options, and put the leading brace on the first line. Then change the default spaces from 4 to 3. Not sure how those two options became the two changes.
|
|
|
|
|
So, you should have voted for 2nd option.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
"Neither"? Possibly, although I might have tried to be more positive and voted for "Other", instead.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
W∴ Balboos wrote: Neither No, the question was simply if there should be braces or not, not where the braces should go. Your example showed braces so you should vote the 2nd option.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Survey said:
One war at a time. Do you believe everything you read on the internet?
Take some artistic license . . . the compiler/interpreter doesn't care what kind of spacing you use. Don't let one of life's great opportunities pass you by.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
W∴ Balboos wrote: One war at a time. Exactly my point.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
You pick your wars, I'll pick mine.
Tomato, potato.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Fanbois, all of you!
I have spent the weekend with refreshing assembly. And what do I have to see here? You guys probably would hate it, because there is not very much you could argue over and no company that provides you with a style guide that is at least as thick as the famous Spanish Court Protocol.
Instead you would be forced to actually think about what you are doing.
I have lived with several Zen masters - all of them were cats.
|
|
|
|
|
CodeWraith wrote: think about what you are doing posting.
FIFY
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Note the explanation under the heading: "It's just about the braces. Not about whether the leading brace should or should not be on the same line as the conditional. One war at a time."
I chose "It depends" instead of having 15 other options purely to focus the debate on the important question and not let it get dragged off into the weeds.
cheers
Chris Maunder
|
|
|
|
|
Chris Maunder wrote: I chose "It depends"
and you'd be wrong Maunder.
like those people who say "haitch" instead of "aitch" for the letter "h" - they need..."correction"
Bryce
|
|
|
|
|
You, then underestimate the important question, to wit:
"Do they do it my way or the wrong way".
All other questions just paraphrase the above . . . trust me on this.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Especially without any comments:
condition && statement;
|
|
|
|
|
if(condition) statement;
Single/simple statement, and it's not a loop (for, while), might be put on the same line.
And never ever do;
if(condition) { statement; }
By the way, Alt 1 ought to be punishable ...
The number of "code fixes" I've seen in the form of;
if(condition)
statement;
being changed to
if(condition)
statement;
statement;
In one project I even found three statements ... Be safe, use BRACEs.
|
|
|
|
|
Alternative 3 is my favourite too.
|
|
|
|
|
{} are called braces, not brackets. Brackets are these things: ()
Anyway ... I prefer a language where they're not needed at all!
If condition Then ...do something
|
|
|
|
|
Or, perhaps, they are both brackets.
I like that you kvetch about the braces being called brackets, and then proceed to call parentheses brackets.
At any rate, both are subset members of a superset known as: brackets.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Being pedantic again, I think kvetch is a bit strong... it was only a little dig
But to go on (and on and bloody on!) about it ... the wonderful thing about the English language is its rich vocabulary. It's a shame to waste it.
|
|
|
|
|
So rich that I went to Yiddish! Oy vey!
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
A_Griffin wrote: Brackets are these things: () Actually those are parentheses. Brackets are []
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Common usage allows for either. But calling {} brackets is just wrong. Or American. (Same difference )
|
|
|
|
|
Certainly not "American".
() Parentheses
{} Braces
[] Brackets
|
|
|
|
|
Exactly. Not sure what he was talking about.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
A_Griffin wrote: Common usage allows for either. Where is it common to call () either parentheses or brackets?
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
if(condition) {
} else {
}
Press F1 for help or google it.
Greetings from Germany
|
|
|
|