Argument declaration style (Was: ANSI C prototypes)

Dan Salomon salomon at ccu.umanitoba.ca
Thu Nov 29 05:38:50 AEST 1990


In article <1990Nov06.233654.29974 at dirtydog.ima.isc.com> karl at ima.isc.com (Karl Heuer) writes:
> ... (Also, I very rarely have a function
> whose prototype doesn't fit on a single line.)
> 
> Even with pre-ANSI code I use
> 	void foo(x, y) char *x; int y; {

This is kind of a wimpy example isn't it?  When working on a large
project like a compiler, or a CAD tool, one tends to get MUCH longer
variable names and type names.  Even two-parameter function headers can
get rather large in such cases.
E.g.

ST_Gen_Class *ST_Lookup_No_Err (char *found_symb; Scope_Level_Ptr Start_Scope);

This is a fictious example, but more resembles my code than does your
example.  With single-letter formal parameter names, the spaces, stars,
and semicolons are quite visible, but with longer parameter and
type names, they tend to get lost.  For long headers like these,
splitting the formal parameters across lines improves readability.
-- 

Dan Salomon -- salomon at ccu.UManitoba.CA
               Dept. of Computer Science / University of Manitoba
	       Winnipeg, Manitoba, Canada  R3T 2N2 / (204) 275-6682



More information about the Comp.lang.c mailing list