[Top][All Lists]

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

Re: make token stacks to work with c++ compiler

From: Paul Eggert
Subject: Re: make token stacks to work with c++ compiler
Date: 03 Apr 2003 22:45:15 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

"Coe, Rich (MED)" <address@hidden> writes:

> The following patch reverts a change which was made sometime after 
> bison-1.28.  Without this patch, when the bison output is compiled 
> with a c++ compiler, it prevents the token stack from growing beyond its
> initial size. 

I'm not a C++ expert, but I've been told that if you are compiling
with C++, the token-stack growing code violates the C++ standard when
YYLTYPE or YYSTYPE is a type where you have overridden the default
copying operations.  If you know that the types are trivial ones that
use the same copying semantics as C, then you should define
YYLTYPE_IS_TRIVIAL and YYSTYPE_IS_TRIVIAL to nonzero values.  Bison
normally does this by default, but if you've specified your own
YYLTYPE or YYSTYPE then you must do it for your type.

This ugliness isn't documented, mostly because I don't know C++ that
well and find it hard to believe that this is the best we can do in
this area.  I'd rather modify yacc.c so that it just works with C++,
regardless of whether YYLTYPE and YYSTYPE are trivial.

reply via email to

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