(Honestly, though, I can't see the point of putting the opening brace on its own line anymore, either. K&R declarations are dead.)
>>13
For return, I agree. sizeof does require parens sometimes, however, so I'd rather just use them all the time. It's the same rationale that justifies putting braces around one-statement blocks in control expressions.
>>15
What? Really? That seems very un-Jersey to me.
How can they justify doing that? If they're going to enforce an indent style, just do what Python does and dispense with the braces entirely; they're no longer needed at that point.
Name:
Anonymous2012-09-14 4:33
And what logic do you faggots have for not using parenthesis in your returns? And if you don't use parenthesis for sizeof then you probably shouldn't be programming because they are necessary.
Rob Pike justifies it by saying that he wanted to prohibit lookahead in the lexical parser, while still having each line of code divided by newlines. It's also apparently good for implementing REPLs.
Everyone else just says that they want to make style wars illegal.
Rob Pike justifies it by saying that he wanted to prohibit lookahead in the lexical parser, while still having each line of code divided by newlines. It's also apparently good for implementing REPLs.
That's some extreme “Worse is Better” attitude. No wonder Go and Plan9 are utter shit.
>>15 Go won't compile without K&R-style braces.
Yes it will. What you mean is Go won't compile with K&R-style braces, because the Go compiler will add semi-colons where it think they're needed, and a function definition without an opening braces qualifies (same as in Javascript).
Name:
Anonymous2012-09-14 17:14
it's not K&R style it's the so called "One True Brace Style"
I don't understand the (braces) styles war and may never on my own. Can someone narrate their oral tradition to me, or is there a trust resource that explains it?