[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [off-topic] flex/bison compatibility issues using C++
From: |
Hans Aberg |
Subject: |
Re: [off-topic] flex/bison compatibility issues using C++ |
Date: |
Fri, 4 Jun 2004 10:42:03 +0200 |
At 00:12 -0700 2004/06/04, Paul Eggert wrote:
>> I got our network admin to install 1.875 but am encountering the
>> same errors (yylex and yyerror undeclared in [filename].tab.c).
>
>That's a general problem with the Yacc interface; it's not limited to
>Bison. The original Yacc interface was designed when one could call
>functions like yylex and yyerror without declaring them. With C++ you
>need to declare them. So you need to (say) put declarations in a
>header file somewhere, and include that header.
If one is using the Bison C-parser under C++, then one should be aware of
that the C stacks under C++ do not invoke the copy-constructors when the
stack is re-allocated. And under C++, one cannot use the %union feature, as
it is implemented using the C/C++ union construct, and under C++, types
with non-trivial constructors cannot be used with unions.
Hans Aberg