[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bison and C++
From: |
Hans Aberg |
Subject: |
Bison and C++ |
Date: |
Sat, 14 Oct 2000 13:41:01 +0200 |
It is fact possible to have the top-node in C even though the rest is
written in C++:
One simply writes in C++:
extern "C" { int main(...) { /* C++ code */ } }
or
extern "C" int main(...) { /* C++ code */ }
as the "extern" clause only applies to the type of _linkage_, and not what
is in the definition of it. Instead of "C", one could also have "Pascal",
"Fortran" or whatever, only if the compiler can handle it; but one is
guaranteed that "C" will always work.
Therefore the use of C++ is only restricted to the availability of
compilers. My guess is that as the C++ standard ANSI/ISO/IEC 14882-1998 is
now a few years old and available from ANSI for only $18 (same price as for
the new C standard ANSI/ISO/IEC 9899-1999 formerly called C9X),
availability is rife.
One reasonable approach for a program that might be used as a library from
a program written in C is to supply a C entry-point.
Hans Aberg
- Re: Bison's semantic parsers, Hans Aberg, 2000/10/07
- Re: Bison's semantic parsers, Richard Stallman, 2000/10/11
- Re: Bison's semantic parsers, Hans Aberg, 2000/10/11
- Re: Bison's semantic parsers, Hans Aberg, 2000/10/12
- Bison and C++,
Hans Aberg <=
- Re: Bison and C++, Richard Stallman, 2000/10/15
- Re: Bison and C++, Hans Aberg, 2000/10/15
- Re: Bison and C++, Richard Stallman, 2000/10/16
- Re: Bison and C++, Hans Aberg, 2000/10/16
Re: Bison's semantic parsers, Richard Stallman, 2000/10/11