Created
July 6, 2017 10:57
-
-
Save stringsn88keys/871f2b3a5267fd89f62547951f3e0690 to your computer and use it in GitHub Desktop.
C indentation styles from wikipedia "Indent Style"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From https://en.wikipedia.org/wiki/Indent_style | |
// K & R | |
while (x == y) { | |
something(); | |
somethingelse(); | |
} | |
// 1TBS | |
if (x < 0) { | |
puts("Negative"); | |
} else { | |
nonnegative(x); | |
} | |
// Stroustup | |
if (x < 0) { | |
puts("Negative"); | |
negative(x); | |
} | |
else { | |
puts("Non-negative"); | |
nonnegative(x); | |
} | |
// Allman | |
while (x == y) | |
{ | |
something(); | |
somethingelse(); | |
} | |
// GNU | |
while (x == y) | |
{ | |
something(); | |
somethingelse(); | |
} | |
// Whitesmiths | |
while (x == y) | |
{ | |
something(); | |
somethingelse(); | |
} | |
// Horstmann | |
while (x == y) | |
{ something(); | |
somethingelse(); | |
} | |
// Pico | |
while (x == y) | |
{ something(); | |
somethingelse(); } | |
// Ratliff | |
while (x == y) { | |
something(); | |
somethingelse(); | |
} | |
// LISP | |
while (x == y) { | |
something(); | |
somethingelse(); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment