|
0x01AA wrote: Excuse me, I didn't know about that. @code-witch uses single line if and for statements.
Even "single line" for statements in other for statements
The madness is pretty obvious I think...
|
|
|
|
|
for(var x=0;x<width;++x)
for(var y=0;y<height;++y)
if(0==(x % y))
graphics.DrawPoint(x,y,Color.Red);
Real programmers use butterflies
|
|
|
|
|
Both using braces and indenting is, in principle reudundant, I can't protest against that.
One of the most common problems (although in the "minor" class - they are almost always caught by the compiler) is getting the braces and indentations right - especially in C-like languages where the closing brace is "anonymous", with no indication of what it closes (no ENDFOR, OD, ENDWHILE or anything of that sort.
So I see the redundancy as a great aid to getting things right: There is never an opening brace without an indent, and never an indent without an opening brace. Never an undent without a closing brace, never a closing brace without an undent.
When an indent may or may not come with another level of bracing, and the next statement following that for-for-if were (incorrectly) indented or undented, and the function goes on for thirty lines with this mis-indentation, it could be difficult to spot the location of the missing or extra brace. The compiler will hopefully tell you that something is wrong, but it might require some work to decide what is wrong: Maybe the next statement really belongs within the inner for-loop, so the problem was a missing brace, not an incorrect indentation.
So, I go for redundancy: Neither indentation nor braces, or both indentation and braces. For the last if-statement: If you don't want the braces, then rather put it all on one line (as long as it doesn't exceed 70 chars). You know that after an if-condition, the rest of the line is either a single, short expression which is the entire if-clause, or a brace that opens an indented block. (The only thing that may follow an opening brace is an end-of-line comment.)
Obviously, the compiler doesn't care. This is only for my own sake, to make it easier for myself to spot where there is an error in the nesting levels.
|
|
|
|
|
I just hate this:
}
}
}
}
Though if I'm working in a shop, I adopt whatever standards they use, if they're available. If I'm in charge of setting standards, I'd agree with yours. In my own code, I just code as I feel. I do it for enjoyment, and I like the freedom of it.
Real programmers use butterflies
|
|
|
|
|
It burns my eyes! ARGHHHH!!!
|
|
|
|
|
Isn't Roslyn open source? How about helping out?
|
|
|
|
|
Honestly, I think adding more to the clusterfark that's already there wouldn't help matters.
I am kinda working with it right now to see if I can't write some suitable helpers for it, but there's a significant learning curve even just in using it.
Real programmers use butterflies
|
|
|
|
|
Roslyn dev #1: "We should totally output single line if statements."
Roslyn dev #2: "We should definitely NOT do that..."
Manager: "Alright guys, break it up! I'm going to make a decision here and say we start with a curly brace, but don't end it so everyone's happy!"
Result:
if (something)
{SomeMethod();
NextMethod(); You know this may not even be so far from the truth
|
|
|
|
|
It's thanks to .. the awesome power of design by committee!
|
|
|
|
|
Taking inspirations from our friend Dandy's crazy idea[^] I rolled my notebook exhausts with tapes.
Then I showered PASTAS[^]... through 6 browser windows.
Laptop got red hot. All the final bunch of anterrorists ran out, got crushed by me. And some of them died inside. Occasionally falling down the exhaust grills as dead corpse.
Mission success.
|
|
|
|
|
Nand32 wrote: Mission success.
You can't be sure of that until you open it up - you may find you have Anthill Inside ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Ants dig, but (as far as I know) don't build a nest like bees or wasps would.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
|
Let me increase the PASTA count tonight.
|
|
|
|
|
Poor ants. They most likely were not trying to build a nest in your notebook, like ant 1.0 would have done. In my former home a young ant 1.0 queen would try to establish a new nest inside a window frame around this time every year.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
|
Ant is just following REST protocol In Peace.
|
|
|
|
|
Nand32 wrote: Then I showered PASTAS[^]
That's not pasta; it's anti-pasta!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Substitution for unknowns (5)
|
|
|
|
|
Substitution
for PRO
unknowns XY
PROXY
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I thought you were dead...
...but ya
|
|
|
|
|
The reports of my death since Thursday[^] are greatly exaggerated.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
and I've taken all my clothes off and opened all the windows.
I feel so much better but the other people on the bus seem very uncomfortable?
I'm not sure how many it cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
/ravi
|
|
|
|
|
That must be because you opened all the windows, it can get very drafty
|
|
|
|