Skip to content

Instantly share code, notes, and snippets.

@stringsn88keys
Created July 6, 2017 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stringsn88keys/871f2b3a5267fd89f62547951f3e0690 to your computer and use it in GitHub Desktop.
Save stringsn88keys/871f2b3a5267fd89f62547951f3e0690 to your computer and use it in GitHub Desktop.
C indentation styles from wikipedia "Indent Style"
// 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