Style Poll
-
Well... since nobody does, I dare to say I use and prefer A. I find it MUCH more readable, uses less screen space (we all know what a screen-eater is VS), and I save an Enter at each indent. When I need to underline the bracket of course B is the way to go, but often simple indentation is enough. Oh, and one last thing: for function definitions A is my preferred way. Example:
void DailyPrayer(int times)
{
for (int i = 0; i < times; ++i) {
printf("I love CP\r\n");
printf("And you?\r\n");
}for (int i = 0; i < times; ++i) printf("http://www.codeproject.com");
}
Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)
I would enjoy programming with you, Sir! :cool: -- Meine Welt ist monoton und minimal, doch ganz total!
-
Ah... I guess it's almost as if I was right when I said that post voting sucks :-) Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
Christian Graus wrote: Ah... I guess it's almost as if I was right when I said that post voting sucks I've said many-a-times that voting would have a tendency to suck a lot less if we could tell who the voters were and what their vote was. This anonymous voting crap is almost as bad as allowing anonymous posts in the lounge. Regards, Alvaro
"I do" is both the shortest and the longest sentence in the English language.
-
How do you guys bracket your code? A:
if(true){
DoSomething();
DoSomethingElse();
}B:
if(true)
{
DoSomething();
DoSomethingElse();
}C: Other ~Nitron.
ññòòïðïðB A
startB! I really can't stand code that is formated as A, it gets to be a PITA when trying to trace down where it begins and ends. -Steven Hicks
CPA
CodeProjectAddict
Actual Linux Penguins were harmed in the creation of this message.
More tutorials: Ltpb.8m.com: Tutorials |404Browser.com (Download Link)
-
How do you guys bracket your code? A:
if(true){
DoSomething();
DoSomethingElse();
}B:
if(true)
{
DoSomething();
DoSomethingElse();
}C: Other ~Nitron.
ññòòïðïðB A
startI used to use (B) for years (cut my teeth on Windows), but after working in a Java shop for a couple of years, I switched to (A). Now, (A) just feels right and sorta more "hardcore" than (B), which feels weenie like. Go figure. :) /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com
-
How do you guys bracket your code? A:
if(true){
DoSomething();
DoSomethingElse();
}B:
if(true)
{
DoSomething();
DoSomethingElse();
}C: Other ~Nitron.
ññòòïðïðB A
startThere are two rules of style: 1. I put the braces in different places than you. 2. Your style is lame. ;) --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
-
There are two rules of style: 1. I put the braces in different places than you. 2. Your style is lame. ;) --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
I agree. ;) Michael Dunn wrote: 1. I put the braces in different places than you. Taken out of context, I bloody well hope so! :-D -- Meine Welt ist monoton und minimal, doch ganz total!
-
I used to use (B) for years (cut my teeth on Windows), but after working in a Java shop for a couple of years, I switched to (A). Now, (A) just feels right and sorta more "hardcore" than (B), which feels weenie like. Go figure. :) /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com
It's K&R (partially) hardcore. :cool: -- Meine Welt ist monoton und minimal, doch ganz total!
-
B: I wonder why no body mentioned one clear advantage of A in the old times? what is wrong with this code?
if(true){; DoSomething(); DoSomethingElse(); }
Yusuf wrote: what is wrong with this code? Nothing..? Unless you believe an extra empty statement is wrong. Had you written:
if(true);
{
DoSomething();
DoSomethingElse();
}there would have been something (most likely) wrong. -- Meine Welt ist monoton und minimal, doch ganz total!
-
I started out with B, and ended up with A. :cool: A is truly for those who have not only seen the light, but felt it and embraced it. It's like being touched by the hand of God. Or so they say. ;) -- Meine Welt ist monoton und minimal, doch ganz total!
-
I use B, always have, always will ( well, not really, I believe having a standard is more important than it's details, I would follow any standard my employer set ). But I'm curious about a few things 1. With two simple choices, why was this not a 'vote 5 for, vote 1 for' poll, and 2. Why is it that every post on this thread that I look at has been voted for twice and has a score of 3 ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
-
There are two rules of style: 1. I put the braces in different places than you. 2. Your style is lame. ;) --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
Given Mikes clear infatuation with Erica, I say we all contribute some money into a pot, ask Chris to call someone at MS HR (or wherever) and set Mike up with a date with Erica! I'm in for $20! ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned
-
How do you guys bracket your code? A:
if(true){
DoSomething();
DoSomethingElse();
}B:
if(true)
{
DoSomething();
DoSomethingElse();
}C: Other ~Nitron.
ññòòïðïðB A
startDefinitly A because I want to conserve lines and B is no more readable to me than A. John
-
It's K&R (partially) hardcore. :cool: -- Meine Welt ist monoton und minimal, doch ganz total!
K&R rocks. I still have my 1980 edition. :) /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com
-
Well... since nobody does, I dare to say I use and prefer A. I find it MUCH more readable, uses less screen space (we all know what a screen-eater is VS), and I save an Enter at each indent. When I need to underline the bracket of course B is the way to go, but often simple indentation is enough. Oh, and one last thing: for function definitions A is my preferred way. Example:
void DailyPrayer(int times)
{
for (int i = 0; i < times; ++i) {
printf("I love CP\r\n");
printf("And you?\r\n");
}for (int i = 0; i < times; ++i) printf("http://www.codeproject.com");
}
Luca Leonardo Scorcia http://zip.to/kojak (only in Italian)