Brace style
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
The latter. For me it is a lot more readable.
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
What annoys me more than either brace style is the people who complain about the style that they don't like. Use whichever but get used to reading both.
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
The latter; the first form drives me nuts.
Steve
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
The real problem with braces is not the style itself, but different styles in the same project, or even file. Most IDEs can reformat the code, but that way there are a few problems with source control... BTW, I prefer this:
if(true) {
// Blah
}If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Blog - My Photos - ScrewTurn Wiki
-
I need this option: IF ' blah blah END IF ;P
---------------------------- **** JOB23743 Submitted ****
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
-
The latter. The former is used only by miscreants and rogues. :suss:
----
i hope you are feeling sleepy for people not calling you by the same.
--BarnaKol on abusive words
LOL That used to be me. Don't know why but lately I switched to the latter.
The only thing unpredictable about me is just how predictable I'm going to be.
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
I used to work with a guy that strongly argued for: if { //do something } (He felt that "as a container", the braces themselves needed to be indented. There was a survey back on the old DevelopMentor boards when .NET was still young. The result was about 30% #1, 70% #2 and 1 person "#3")
-------------- TTFN - Kent
-
The latter. The former is used only by miscreants and rogues. :suss:
----
i hope you are feeling sleepy for people not calling you by the same.
--BarnaKol on abusive words
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
The later ... but when i'm furiously typing, sometimes the Enter doesn't hit and that damn bracket stays on the same line .... When such hidious sine is uppon me i immediatelly grab my whip, face the floor and start whipping my self on the back shouting "FORGIVE MY KEYBOARD FATHER FOR IT DOESN'T KNOW WHAT IT'S DOING" :->
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
Navaneeth.Which one you prefer ?
Over the shoulder with a single clip at the back. I find the ones that attach at each side far too restrictive.
Ðavid Wulff What kind of music should programmers listen to?
Join the Code Project Last.fm group | dwulff
I'm so gangsta I eat cereal without the milk -
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
Last one complies to coding standards. First one is for folk who don't know any better. How about an if that runs only 1 line of code. A:
if{//do something} dothis other code.....
B:if{//do something} { dothis } other code.....
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture) http://www.frankkerrigan.com/[^]
-
The latter. The former is used only by miscreants and rogues. :suss:
----
i hope you are feeling sleepy for people not calling you by the same.
--BarnaKol on abusive words
Mmm.. yes. You better watch behind your bracket when you code. ;)
-- Raaaaaaaaaaaaaaaaaaaaa!
-
Last one complies to coding standards. First one is for folk who don't know any better. How about an if that runs only 1 line of code. A:
if{//do something} dothis other code.....
B:if{//do something} { dothis } other code.....
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture) http://www.frankkerrigan.com/[^]
This is all about readability (compilers don't give two hoots). Braces around one line of code make it LESS readable -- your codes ends up spanning too many lines / pages. Btw, indentation is vital, so the form should be: if (condition) do domething; other code where the blank line before the 'other code' is also vital. (And then there's the debate about whether there should be some comments against each block of code, but I won't go there!)
-
This is all about readability (compilers don't give two hoots). Braces around one line of code make it LESS readable -- your codes ends up spanning too many lines / pages. Btw, indentation is vital, so the form should be: if (condition) do domething; other code where the blank line before the 'other code' is also vital. (And then there's the debate about whether there should be some comments against each block of code, but I won't go there!)
Do'h, of course HTML strips spaces! so, try again: if (condition) do something; other code;
-
Do'h, of course HTML strips spaces! so, try again: if (condition) do something; other code;
:-D
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture) http://www.frankkerrigan.com/[^]
-
Which one you prefer ?
if{
//do something
}Or
if
{
//do something
}
printf("Navaneeth!!") www.w3hearts.com
Who cares? Does this actually improve the quality of your code in any way? Does the first version produce different code to the second? It doesn't matter. As long as you are consistent and follow internal coding standards then it shouldn't matter which one it is.
Deja View - the feeling that you've seen this post before.