[comp.sys.mac.programmer] C+- vs. C++ comparison

roseman@cpsc.ucalgary.ca (Mark Roseman) (05/14/91)

Does anyone have handy a complete list of differences
between Think C and C++?  I'm wondering about the possibility
of a mostly-automatic translation schema between the two.
Any informed thoughts as to the feasibility of this?


-- 
==============================================================================
Mark Roseman
Dept. of Computer Science, University of Calgary, Calgary, Alta.  T2N 1N4
(403) 220-5769   roseman@cpsc.ucalgary.ca    {ubc-cs|alberta}!calgary!roseman

Jim.Spencer@p510.f22.n282.z1.fidonet.org (Jim Spencer) (05/18/91)

Mark Roseman writes in a message to All

MR> Does anyone have handy a complete list of differences between 
MR> Think C and C++? I'm wondering about the possibility of a mostly-automatic 
MR> translation schema between the two. Any informed thoughts as 
MR> to the feasibility of this? 

Going from Think C to C++ isn't all that tough, the principle thing being that Think C doesn't use the virtual keyword (all member functions are virtual.)  You can get around this by declaring "#define virtual" in your Think C versions and add the virtual keyword in front of all of your member functions.

Going the other way is more difficult as there are C++ features that are simply not implemented in Think C including:

1) default arguments

2) constructors and destructors

3) multiple inheritance

You can get around the following but only by changing the nature of the code

4) protected and private members and member functions

5) const definitions

Then there are the fairly easy to fix automatically:

6) double slash comments

7) new and delete are not operators in Think C so parenthesis are required.

There are other problems: Think C uses 16 bit ints while MPW uses 32 bits and some of the functions names are different.
 
 * Origin: White Mailer Test Point (1.0d6) (1:282/22.510)