[antlr-interest] Re: thank you sir

Paul Johnson gt54-antlr at cyconix.com
Thu Oct 27 02:20:10 PDT 2005


Sebastian Kaliszewski wrote:
> Terence Parr wrote:
> 
>> C++ is C so I'm not sure you have a problem with anything except the  
>> io libraries and such; still the Clib should still work with C++ right?
> 
> 
> Well, this is not true. There are many C constructs which are illegal in 
> C++, and some constructs have different meaning (i.e. my_type my_fun() 
> vs my_type my_fun(void)).

As Stroustrup says in Appx B of his book, "with minor exceptions, C++ is 
a superset of [C89] C... Well-written C programs tend to be C++ programs 
as well". Sure, you can write bad C that won't compile as C++, but you 
can't fix bad C programs automatically, which appears to be what the OP 
wanted.

Anyway, it's not at all obvious what the OP wanted to do. g++ is just a 
driver for GCC: it assumes that the default language is C++, and that 
you need to link against the C++ libraries. It has no problem compiling 
C programs, even bad ones, and certainly ones which aren't valid C++.

Paul



More information about the antlr-interest mailing list