diff options
author | June McEnroe <june@causal.agency> | 2021-03-16 18:09:26 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-03-16 18:09:26 -0400 |
commit | 56629a090cef19f51084fdcc99727322fef23668 (patch) | |
tree | 2f2407db91146767f91c94cad819c208d54d0ed0 | |
parent | Publish "C Style" (diff) | |
download | src-56629a090cef19f51084fdcc99727322fef23668.tar.gz src-56629a090cef19f51084fdcc99727322fef23668.zip |
Add some missing justification to "C Style"
Diffstat (limited to '')
-rw-r--r-- | www/text.causal.agency/020-c-style.7 | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/www/text.causal.agency/020-c-style.7 b/www/text.causal.agency/020-c-style.7 index d32d3137..9816dbc3 100644 --- a/www/text.causal.agency/020-c-style.7 +++ b/www/text.causal.agency/020-c-style.7 @@ -31,6 +31,12 @@ fprintf( ); .Ed .Pp +Anything that can be sorted +should be sorted, +with trailing commas where possible. +This and block indentation +make for simpler diffs. +.Pp I either write single-line ifs or always use braces. I put parentheses @@ -44,9 +50,6 @@ it's in either all lower case or all upper case. The despicable SCREAMING_SNAKE_CASE is reserved for macros. -Anything that can be sorted -should be sorted. -Trailing commas wherever possible. I don't set globals or statics to zero since that is already the default. I don't compare against zero or NULL @@ -131,6 +134,13 @@ unless I want to do concatenation. .Bd -literal -offset indent enum { Cap = 1024 }; .Ed +.Pp +I avoid the preprocessor +wherever possible, +with the notable exception of X macros, +which I've talked about previously. +Doing things in the actual language +makes for easier debugging. . .Ss Organization I usually use only one header file |