Subject: Re: yacc and PR 4260
To: Aymeric Vincent <Aymeric.Vincent@labri.fr>
From: Alistair Crooks <email@example.com>
Date: 12/28/2002 14:30:33
On Thu, Dec 26, 2002 at 12:02:48AM +0100, Aymeric Vincent wrote:
> Jason R Thorpe <firstname.lastname@example.org> writes:
> > On Sat, Dec 21, 2002 at 09:57:26PM +0100, Krister Walfridsson wrote:
> > > PR 4260 notes that the yacc output has problems on platforms that do not
> > > have ANSI C realloc(3), and thus crash on realloc(NULL, x). I don't
> > > personally care about those systems, and would like to close the PR with
> > > a message saying that these systems are too old to be supported. OTOH, we
> > > do the #if __STDC__ song and dance regarding prototypes etc., so we are
> > > trying to work on at least some non-ANSI systems...
> > >
> > > So what is the "correct" thing to do?
> > Desupport pre-ANSI please.
> I think it's a bit sad to remove such support for the simple special
> case of realloc(NULL, x) which is so easy to handle in a way that
> works with pre-ANSI systems.
Usually I'm all for backwards compatibility, but sometimes it's
necessary to "draw a line" and say "that's too old". Given that C
grew ANSI support (in the form of function prototypes, a fully
specified pre-processor, trigraphs and other "improvements") in or
before 1989, (most compilers were able to support ANSI features before
they became part of the ANSI spec), I think it's time to say "thanks,
and goodbye" to K&R C support, 13+ years on. Not that I think we
should forget it completely - the original C was a concise, neat and
functional language - take a look at the reprint of the Lions book
sometime if you disagree.
> Yacc output is supposed to compile on as many systems as
> possible. When we have a precise example of what is wrong, we could
> fix it.
I found a box of floppies marked 386BSD 0.1 the other day. Even the
gcc that came with those floppies (which hadn't all managed to retain
their format) supported ANSI C. I really doubt that there are systems
out there with only a K&R C compiler which would be capable of doing
any useful work, upon which we'd want to try cross-compiling a source
file generated by yacc on NetBSD. I'd be delighted to be proved