[Swan] visual distinctions in C: function calls vs. control flow

Richard Guy Briggs rgb at tricolour.net
Sat Mar 2 23:00:41 EET 2013


On Sat, Mar 02, 2013 at 02:40:59PM -0500, D. Hugh Redelmeier wrote:
> Function calls and control flow statements can look similar in C:
> name followed by open paren:
> 
> 	if(test) ...
> 	fi(arg) ...
> 
> I think that it makes sense to make these visually distinct:
> 
> - never put a space between a function name and the following paren.
>   (This matches most mathematical usage.  I admit that in math there
>   are other important notational differences.)
> 
> - always put a space between a keyword and a following paren.
> 
> So:
> 	if (test) ...
> 	fi(arg) ...
> 
> Although sizeof is a keyword, it looks best if formatted as a function
> -- it behaves more like a function than a control-flow command.
> 
> This style was observed in Pluto code until I stopped working on it.
> I recommend that it be adopted.

This is exactly the standard adopted by the Linux kernel.

> I welcome debate.

	slainte mhath, RGB

--
Richard Guy Briggs               --  ~\    -- ~\            <hpv.tricolour.net>
<www.TriColour.net>                --  \___   o \@       @       Ride yer bike!
Ottawa, ON, CANADA                  --  Lo_>__M__\\/\%__\\/\%
Vote! -- <greenparty.ca>_____GTVS6#790__(*)__(*)________(*)(*)_________________


More information about the Swan mailing list