From 56629a090cef19f51084fdcc99727322fef23668 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 16 Mar 2021 18:09:26 -0400 Subject: Add some missing justification to "C Style" --- www/text.causal.agency/020-c-style.7 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'www') 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 -- cgit 1.4.1