Subject: Re: C Language Standard(s)
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Erik Bertelsen <erik@sockdev.uni-c.dk>
List: current-users
Date: 01/11/1996 09:34:03
On Wed, 10 Jan 1996, Jason Thorpe wrote:
> On Wed, 10 Jan 1996 00:11:18 -0800
> bwalker@musings.com (Brad Walker) wrote:
>
> > Could someone please explain to me why we are concerned if we maintain
> > compatibility with K&R.. I must have missed that argument. And it's not
> > a good enough argument to say that we need to maintain old code. I would
> > like to hear the why argument and not the because argument.
> >
> > Why not mandate all new code be ANSI.. And work on porting the old stuff.
>
> We're beating a dead horse, but... :-)
>
> Put quite simply, code that utilized K&R-style function decls is just
> "more portable". I quite often rip code out of NetBSD and compile it
> under SunOS (with the native compiler).
I guess that you meen yesteryears SunOS 4, that does not come with an
ISO/ANSI Std. c compiler, and whose libc does not comply with the
Standard C Library ?!
The current SunOS (version 5, part of Solaris 2) does not even come with
a c compiler, but the optional c compiler product does have an ISO/ANSI
std. compiler.
> And there just might be a time
> in the future when someone with a K&R compiler needs to bootstrap NetBSD
> on some new platform...it could happen...
As mentioned before: Is this probability significantly greater than 0?
Is there any realistic posibility of porting NetBSD without porting
gcc first?
>
> Of course, I don't really want to "mandate" anything. I'd much rather
> *encourage* writing clean, portable code.
Yes, I heartily and strongly agree.
But I consider ISO/ANSI C standardized code to be the most portable code. To
put it provocatively, ISO/ANSI Standard C enable you to have code that stays
portable in the future. Compatibility with K&R C is compatibility with the
past.
Finally I will cite two small sections from ISO 9899, the C standard:
6.9.4 Function declarators
The use of function declarators with empty parentheses (not prototype-
format parameter type declarators) is an obsolescent feature.
6.9.5 Function definitions
The use of function definitions with separate parameter identifier and
declaration lists (not prototype-format parameter type and identifier
declarators) is an obsolescent feature.
And as far as I recall from the discussions of the new revision of the C
standard (C9x), the K&R syntax for function declarations and definitions
may even be removed completely from the standard in its next revision.
regards
Erik Bertelsen