This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
Re: Converting xconq to C++
- From: Erik Sigra <sigra at home dot se>
- To: xconq7 at sources dot redhat dot com
- Date: Fri, 29 Mar 2002 13:19:38 +0100
- Subject: Re: Converting xconq to C++
- References: <F109MVwVn20lbhsKd6Q0000b2f4@hotmail.com>
- Reply-to: sigra at home dot se
This has been done to Freeciv a while ago. The approach was this:
* Change all identifiers that are reserved words in C++ but not in C (and,
and_eq, asm, bitand, bitor, catch, class, compl, const_cast, delete,
dynamic_cast, friend, inline, new, not, not_eq, operator, or, or_eq,
private, protected, public, reinterpret_cast, static_cast, template, this,
throw, try, typeid, virtual, xor, xor_eq, ...).
* Add casts that both C and C++ accepts to allocations ("malloc(...)" to
"(material *) malloc(...)").
* Introduce the type "bool" (and of course make sure there are no identifiers
called bool, true or false).
* Compile with g++ instead of gcc and see what else it complains about.
Then the code will be both C and C++, the common subset. Although I prefer
Ada...