Argument declaration style (Was: ANSI C prototypes)

Karl Heuer karl at ima.isc.com
Wed Nov 7 10:36:54 AEST 1990


In article <3944.27367fb2 at cc.helsinki.fi> jaakola at cc.helsinki.fi writes:
>Yeah, everything *would* work fine, if we assumed infinite line width!

It consumes more width than your style, but it also consumes less height.  I
consider that a useful tradeoff, as it makes it more likely that the entire
function will fit on a single screen.  (Also, I very rarely have a function
whose prototype doesn't fit on a single line.)

>The point is: with the old style you can put enough information on a
>SINGLE line - the most natural unit of textual information in UNIX-
>like environments.

This is interesting, because I use the exact same argument in *favor* of the
new style.  If you write
	void foo(x, y)
	  char *x;
	  int y;
	{
and you grep for the declaration, you don't see the types of the arguments.
(And it's even worse if you put the "void" on a separate line!)  With
	void foo(char *x, int y) {
you see all the relevant information at once.  Even with pre-ANSI code I use
	void foo(x, y) char *x; int y; {
for the same reason, but the invention of prototypes made most lines shorter.

Karl W. Z. Heuer (karl at ima.isc.com or uunet!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list