Beginning C++ in FreeBSD

Daniela dgw at liwest.at
Fri Apr 16 14:47:50 PDT 2004


On Friday 16 April 2004 20:31, Kai Grossjohann wrote:
> Daniela <dgw at liwest.at> writes:
> > What? C++ code is converted to C? Which compiler are you using, and
> > why the hell would a compiler do this?
>
> In the old days, C++ was implemented by a program called cfront, I
> believe, and it did convert C++ to C.
>
> If you can write a program that converts language X to C, then you get
> to take advantage of all the nifty optimizing C compilers out there.
> If you try to go the direct route to compiling into machine language,
> then you need to do the optimization part yourself.  So converting
> into C as an intermediary language is an option that requires less
> work.

There's no harm in doing the optimizing yourself. If you compile directly, 
then you can optimize much more because you can take advantage of the 
structure of the language. Two different languages always have different 
strengths and weak points.
BTW, when I need somthing optimized, I'll do it in assembly anyway.

> GCC has a backend which can server as an intermediary language, I
> guess, but if you convert into C, then you aren't even wedded to GCC.
>
> Kai
>
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at freebsd.org"



More information about the freebsd-questions mailing list