Curly braces
1
Name:
Anonymous
2011-04-21 23:28
RITE
int main() {
if (hurr) return durr;
return OHGODHOWDIDTHISGETHEREIAMNOTGOODWITHCOMPUTER;
}
RONG
int main()
{
if (hurr)
{
return durr;
}
return OHGODHOWDIDTHISGETHEREIAMNOTGOODWITHCOMPUTER;
}
excessive whitespace == unreadable
2
Name:
Anonymous
2011-04-21 23:31
int
main()
{
if (hurr) {
return durr;
}
return OHGODHOWDIDTHISGETHEREIAMNOTGOODWITHCOMPUTER;
}
3
Name:
Anonymous
2011-04-21 23:32
You're doing it wrong, the return statement should be on its own line if you follow the
ONE TRUE BRACE STYLE . Why? It's more consistent.
http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS
4
Name:
Anonymous
2011-04-21 23:43
5
Name:
Anonymous
2011-04-22 0:02
The only thing that really matters is that you are consistent.
6
Name:
Anonymous
2011-04-22 2:06
this isnt a problem in python :3c
7
Name:
Anonymous
2011-04-22 3:18
>>1
Java "style", GNU `style'.
>>2
Braindamaged K&R.
>>3
u mena
int main(int argc, char **argv)
{
if (hurr) {
return durr;
}
return OHGODHOWDIDTHISGETHEREIAMNOTGOODWITHCOMPUTER;
}
8
Name:
Anonymous
2011-04-22 4:05
int main()
{
if (hurr)
return durr;
return OHGODHOWDIDTHISGETHEREIAMNOTGOODWITHCOMPUTER;
}
Right!
9
Name:
Anonymous
2011-04-22 4:36
The One, True Style.
int
main
(
)
{
if (
hurr
)
{
return durr;
}
return OHGODHOWDIDTHISGETTHEREIAMNOTGOODWITHCOMPUTER;
}
10
Name:
Anonymous
2011-04-22 5:02
>>9
Yeah, it's nice, but I don't like how you put the "int" and "main" to different lines.
11
Name:
Anonymous
2011-04-22 6:11
int main() { return (hurr? durr : OHGODHOWDIDTHISGETTHEREIAMNOTGOODWITHCOMPUTER);}
12
Name:
Anonymous
2011-04-22 6:25
basement nerd
int main() {
if (hurr) {
return durr;
}
return OHGODHOWDIDTHISGETHEREIAMNOTGOODWITHCOMPUTER;
}
ENTERPRISE programmer
int main()
{
if (hurr)
{
return durr;
}
return OHGODHOWDIDTHISGETHEREIAMNOTGOODWITHCOMPUTER;
}
13
Name:
Anonymous
2011-04-22 6:52
zarun no erika
14
Name:
Anonymous
2011-04-22 7:20
>>12
Close, but it's not quite
ENTERPRISE -level.
basement nerd
int main() {
if (hurr) {
return durr;
}
return OHGODHOWDIDTHISGETHEREIAMNOTGOODWITHCOMPUTER;
}ENTERPRISE programmer
class MyDurrApplication
{
public static void main(String[] args)
{
if (hurr)
{
System.out.println("durr!"); // Display the string.
return; // Terminate from the main method.
}
System.out.println("OHGODHOWDIDTHISGETHEREIAMNOTGOODWITHCOMPUTER"); // Print an error message.
return; // Extra redundancy to ensure we terminate the method.
}
}
15
Name:
Anonymous
2011-04-22 8:13
>>7
That's the Allman style, not GNU.
Beauty:
int main()
{
if(I don't type like an idiot, sorry.) {
return 0;
}
return 1;
}
16
Name:
Anonymous
2011-04-22 14:09
17
Name:
Anonymous
2011-04-22 14:16
>>16
ONE WORD: THE FORCED INDENTATION OF CODE. THREAD OVER
18
Name:
Anonymous
2011-04-22 14:56
>>16
Nobody here gets it, loungeman.
19
Name:
Anonymous
2011-04-22 15:28
>>10
I was actually just trolling. Nobody should indent like this.
20
Name:
Anonymous
2011-04-22 15:29
>>19
But you just got trolled back.
21
Name:
Anonymous
2011-04-22 17:15
>>20
Why do I not feel trolled?
22
Name:
Anonymous
2011-04-22 17:34
ONE TRUE STYLE TO OWN AND DOMINATE THEM ALL
int main()
{
if(hurr) return durr;
return derp;
}
For longer flow control statements (like for), one could move the statement after it into next line (with an extra indent), like this:
[code] for (int commonIntegerIterator = 0; commonIntegerIterator < iteratedStructure.size(); commonIntegerIterator++)
performRequiredFunction(controlStructure, securityDatabase, exceptionHandling.getExceptionHandlingFunction(currentType));
23
Name:
Anonymous
2011-04-22 17:36
IMPORTANT ANNOUNCEMENT: Last release of One True Standard was unfinished. Here we provide a fixed version, free of charge for both premium and regular users. We apologize for the inconvenience.
for (int commonIntegerIterator = 0; commonIntegerIterator < iteratedStructure.size(); commonIntegerIterator++)
performRequiredFunction(controlStructure, securityDatabase, exceptionHandling.getExceptionHandlingFunction(currentType));
24
Name:
Anonymous
2011-04-22 19:32