commit b3988f4f12c8f66742457c652069b6797d6df6ea Author: Jacob Signorovitch Date: Tue Jan 14 13:19:25 2025 -0500 Initial commit. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c701946 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Style Guide + +This document lays out my general style guide when writing code, mostly in C. + +## General Opinions + +- Lines should try to be at most 80 columns. +- Four (4) spaces in a tab. No tab characters. +- THE POINTER GOES ON THE LEFT. +- Single line (`//`) comments for comments on the code. Multi-line (`/**/`) for + other things, e.g. examples, algorithm explanations, narratives, &c. + +## Line Breaks + +In general, keep things on as few lines as possible / legible. Obviously, this +means function declarations should be on one line if possible. Keep as best as +possible to an 80-column limit. + +Examples: + +```C +looooooooooooooooooong type +llllllllllong_function_name(with a, lot of, arguments* h) { + return something; +} +``` + +```C +// Skip all whitespace. +while (*inp == ' ' || *inp == '\t') inp++; +``` + +## Comment Style + +In comments, when mentioning things *in* the code, use backticks (`\`\``).