Subject: C vs. prototypes (was: Problems with gdb under NetBSD 1.0 )
To: Bakul Shah <firstname.lastname@example.org>
From: Greg A. Woods <email@example.com>
Date: 12/14/1994 14:57:52
[[ DAMN! for some reason I'm missing a few messages from current-users,
though my colleague on the same exploder address got them! I guess we
have a local mail delivery problem -- something I just don't want to
have to deal with right now! ARGH! ]]
[ On Tue, December 13, 1994 at 11:33:22 (-0800), Bakul Shah wrote: ]
> Subject: Re: Problems with gdb under NetBSD 1.0
BTW, lseek(2) is a *very* bad example of this problem and completely
misses/hides some of the issues involved (though the following comment
ferrets them out somewhat).
> This is a major problem. The usual way out is to create a
> declaration of your own but then it conflicts with a
> declaration of the same thing in a vendor provided include
> file. I consider writing your own prototype to be
> equivalent to casting the whole damn call! Alas, it is not
> always possible to avoid it.
> Someone ought write a book on porting software and how to
> write portable software.
IMNSHO (having ported hundreds of thousands of lines of C to everything
from MeSsy-DOgS to every flavour of UNIX still running), it was easier
to both write portable software, and to port software, before ANSI-C got
their fingers in this mess. Thanks a bunch Bjarne!
Prototypes do two bad things -- first they take away some of the rope C
so conveniently gives to programmers, and second they force programmers
to do all sorts of hacks such as writing their own prototypes for system
Lint did all of the work prototypes attempt to do, but did a far more
complete and accurate job of it, and doesn't make/allow mistakes.
Yes, it can be viewed that writing a prototype is equivalent to casting
all of the parameters in one fell swoop, *however*, it is often an
invisible cast! (It certainly hides well from grep!)
Actually, I'd live with prototypes *iff* the automatic type coercion was
Greg A. Woods
+1 416 443-1734 VE3TCP robohack!woods
Planix, Inc. <firstname.lastname@example.org>; UniForum Canada <email@example.com>