|
Wow - I thought I was the only one who was ticked off by this. Thanks for making me feel less lonely.
BTW, the code formatting macro that Alvero Mendez (I hope I rememberd his name correctly) uploaded will convert Option 1 to Option 2 quite nicely. I always run that macro on new code first thing.
|
|
|
|
|
Hello !
There is a programming language called "Python". It is without braces !
e.g. ("."=space)
for i in range(1,10):
...print i
print "After the loop"
It uses the idention to mark where the blocks end !
Okay, it's not c++ but I could not resist pressing other
Mfg Florian
|
|
|
|
|
thank god, for some reason i'm always afraid my brace style would piss people off =) now it'll only piss a minority
|
|
|
|
|
I would recommend this book to anyone, BUT skip the section on C brace positioning. It is nice to see others feel the same.
|
|
|
|
|
Good afternoon,
Thanks for this poll... this type of poll helps us roooooookies immensly!
Can we get more coding style polls... like this one?
Thanks!
Scott!
Put the big rocks in the glass jar first!
|
|
|
|
|
yeah, maybe like this:
Which whitespace style do you prefer?
if(func())...
or
if (func())...
or
if( func() )...
or
if ( func() )...
|
|
|
|
|
Well, I like option 2, but it don't always do it:
if( func() )
What about if statements with multiple expressions:
option one:
if( one && two && three )
option two:
if( one &&
two &&
three )
option three:
if( one
&& two
&& three )
|
|
|
|
|
2
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
i like this one:
http://www.possibility.com/Cpp/CppCodingStandard.html
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I just looked at some of my old DOS programs, written in the glorious days of the 25 line monitor. The functions look something like this:
void Func(){
if(a == b){
Func1();
Func2();}
Func3();}
|
|
|
|
|
that looks like crap. I bet finding brace bugs were a bitch and a half.
|
|
|
|
|
> I just looked at some of my old DOS programs [...]
Then you must have been a bit inexperienced as well, if you wrote code like that!
I will not even talk about the 2 space-wide intending...!
-=- James.
|
|
|
|
|
1 - Men wear Jeans, Women do too!
2 - Men put ear rings, Women do too!
And then, which one of above is:
1- Wrong!
2- Right!
3- Common! No problem!
Then, so what? Who cares how any one does as long as code compiles?!
|
|
|
|
|
Who cares? everybody in the development team do! yes, you would not have any problem during the compilation but ... don't you care setting simple standards according to your team's taste or preferences in coding? cheers!
|
|
|
|
|
Let me tell you who cares... I DO!!! I recently came to a software team who previously, as many other places, enforced no standard on style. Yeah, the code compiled but what about 1 year or 2 down the road when the original developer is gone and features must be added and bugs must be fixed. Someone else is of course stuck with some obnoxious looking code trying to make heads or tails out of it. If the code was done cleanly, like style 2, and commented well then the problem is severly reduced and everyones life is a little easier. Compiling code is important but Clean Compiling Code is very important. It helps all those who come after manage what you write.
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Why not put this in context:
"Who cares about readability, as long as the code compiles?"
This ranks right up there with "We don't have time to write a spec - we have to start coding now becasue we have to show a demo in two months!".
Both of these statements should be grounds for ejection from the profession.
|
|
|
|
|
Its all about readability.
The quicker someone can read and match up logical blocks the better.
I still think that every logical block shoud be preceded with a comment stating the correct logic. Alot of people say why do that thats a waste of 40 seconds. I wrote it and the logic is correct. That is true today but what about next year. Will you still be here. Will you always maintain this code? What about 2 years from now will you still remember it?? This lets other programmers understand the intended logic for that block and aids in preventing the logic from being broken years down the road.
I wish this was a LAW of programming..
|
|
|
|
|
Oh, please... Another "code is for compiler" troll...
|
|
|
|
|
Sounds like a "Redmondtonian" to me:
"It compiles? Ship it!"
Remember that more than just the compiler "looks" at code...
-=- James.
|
|
|
|
|
Go read Code Complete - Now!!
And don't show up as anonymous - use your real name so the rest of us know who not to hire!;P
|
|
|
|
|
>And don't show up as anonymous - use your real name so the rest of us >know who not to hire!;
Really? And what if this was a survey question to see how many Fail or Succeed the evaluation?
Wrong answer and have you failed! Watch out on what you post.
|
|
|
|
|
if(blabla && (bla & bla) || (bla | !bla << 1)) /* comment
comment. blablabla.
other comment. */{
func(); func(); func() /*blabla*/}
how about that?
|
|
|
|
|
... and then uou get some degree.
|
|
|
|
|
|