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 | 206a61a60e422b667735415fd5b3f79c436c939a (patch) | |
tree | 196a89c841aeb1424871528124675f882b3f727a | |
parent | Publish "C Style" (diff) | |
download | src-206a61a60e422b667735415fd5b3f79c436c939a.tar.gz src-206a61a60e422b667735415fd5b3f79c436c939a.zip |
Add some missing justification to "C Style"
-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 |