Re: C programm in a C++ compiler
MLM Veraart (Veraart++at++fel.tno.nl)
Wed, 17 Mar 1999 14:14:14 +0100
Baduch Husein wrote:
>
> We would like to use the C++ compiler for new projects, but we want to
> use all our already developed C Performer routines (MIPSpro C Compiler
> 7.2.1 an Performer 2.2).
> Itīs posible to compile a C programm (Performer 2.2) with a C++
> compiler.
> Anyone has tried it ? Did they get any advantage using C++ compiler?
>
Not all C semantic is the same in C++.
Apart from that some of the performer objects are now classes and
the parameter passing has to be done by references
void myFunc(pfVec3 &myvar);
in case they are arrays in performer C (pfVecX, pfMatrix). Otherwise
they would pass by value.
So you have to rewrite the code for this kind of situations.
For the speed aspect. It would be the same within a certain margin.
Not much gain and not much loss. It all depends more on the backend
as Phil noted. Beware that C++ does a lot of things implicitly for
you and that can be a cause that the program is slower. An example
is the construction and destrunction of temporary instances of classes.
Mario
This archive was generated by hypermail 2.0b2
on Wed Mar 17 1999 - 05:13:23 PST