bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bison bug.


From: Hans Aberg
Subject: Re: bison bug.
Date: Sun, 30 Dec 2001 18:43:35 +0100

At 16:10 +0100 2001/12/30, Akim Demaille wrote:
>>> if (nitems >= MAXSHORT) fatal (_("too many items (max %d)"),
>>> MAXSHORT);
>
>Hans> Under STD C, you should #include <limits.h>, and the code can
>Hans> then read: if (nitems >= SHRT_MAX) fatal (_("too many items (max
>Hans> %d)"), SHRT_MAX);
>
>Hans> (And it can never happen that nitems > SHRT_MAX if nitems is a
>Hans> short.)
>
>No, this is wrong.  The limitation must not depend upon the host
>running bison, but the least denominator with all the hosts on which
>the parsers will be compiled.

You may develop the code as you please. But I do not see any point of such
a principle.

One use of Bison is evidently as research for making better parser
generators. Should the Bison sources not facilitate such developments?

>Trust the code, people have been thinking about it.

Be aware of that using int's instead of short may take up more memory, but
that is rather irrelevant, as memory lately has doubled every year. But
int's may provide better alignment, making the code faster.

So, the code should probably better be
#ifndef STATE_TYPE
#define STATE_TYPE short
#endif
typedef STATE_TYPE state_type

Then people can choose.

  Hans Aberg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]