Subject: Re: C vs. prototypes (was: Problems with gdb under NetBSD 1.0 )
To: Greg A. Woods <woods@kuma.web.net>
From: Bakul Shah <bakul@netcom.com>
List: current-users
Date: 12/14/1994 14:51:52
> 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!

I don't think you can blame prototypes on Bjarne Stroustrup
or C++ alone.  A lot of us including me wanted prototypes.
Among other things a prototype documents what types of
arguments are allowed.  Also, even lint used something
similar for libraries.  And if you used lint, where you
could, porting was no easier than it is now.  You still had
to wade through gallons of warnings.

> 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
> functions!

Sorry, I don't buy it.  You can still cast to your heart's
contents.  It is just that the compiler now squaks when you
do something illegal without proper casting.  Second,
the hacks are necessary because system include files are
incorrect or incompatible.  Without prototypes there will
be silent errors in some cases.

> 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.

Well, if you argue for integrating lint in a compiler I
won't complain!

The fundamental problem is C.  It has no concept of an
`interface'.  Ideally it should be possible generate an
interface file from a specification -- then part of the
standardization procedure would've been to generate such an
interface (perhaps even an authenticated one so that you or
the vendor can't much with it!).  Given this users and
implementors can be assured of the interface without this
#include mess.  But I guess the die is now cast and so the
cast won't die.  Sorry!

Bakul