Argument declaration style (Was: ANSI C prototypes)
Karl Heuer
karl at ima.isc.com
Mon Dec 3 09:49:03 AEST 1990
In article <1990Nov28.183850.20592 at ccu.umanitoba.ca> salomon at ccu.umanitoba.ca (Dan Salomon) writes:
>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? [My code would look more like]
>ST_Gen_Class *ST_Lookup_No_Err (char *found_symb; Scope_Level_Ptr Start_Scope);
I stand by my example. I find short names easier to read than longer ones, as
long as they're mnemonic. (In real code the parameters would probably be
named `s' and `n', and if necessary their purpose would be described in a
block comment above the function, which would not be called `foo'.)
In a quick scan of my directory, I find that, of 1491 function definitions in
my style, only 26 of them (1.7%) consume 80 or more columns.
>For long headers like these, splitting the formal parameters across lines
>improves readability.
I strongly disagree.
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