Argument declaration style (WAS: ANSI C prototypes)
jaakola at cc.helsinki.fi
jaakola at cc.helsinki.fi
Tue Nov 6 20:17:37 AEST 1990
om>
Followup-To: m>
Xref: hylka comp.lang.c:12516 alt.religion.computers:1470
Organization: University of Helsinki
Lines: 43
In article <_1X6_32 at xds13.ferranti.com>, peter at ficc.ferranti.com (Peter da Silva) writes:
> If you do this:
>
> static void auxilary_func(int a)
> {
> ...
> }
>
> Everything will work fine. You only need declare it once. Just do it right
> the first time and you won't have to do it again (my father always used to
> tell me that).
Yeah, everything *would* work fine, if we assumed infinite line width!
BUT: - computer screens have finite number of columns
- my favourite editor has finite line width
- my printer has finite line width
- I don't like wrapped lines
I have made an applications generator by simulating object-oriented
methods with plain C (for portability reasons), and I have some
functions with about 10 arguments. And I like descriptive (=long)
names; the arg in the example was "a" for pedagogical reasons...
The most significant advantage of the "old" style is that I can
use the command
grep \)$ *.c
in UNIX or in MS-DOS with the PICNIX utilities to get output like
myfile.c:int foo(a,b)
mydb.c:BOOL open_db(dbname,audit_file,username,password)
mydb.c:BOOL get_record(key,buffer,bufferlen)
..
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.
--
Juhani Jaakola, University of Helsinki
More information about the Comp.lang.c
mailing list