Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Apr 2004 20:10:17 +0200
From:      Kai Grossjohann <kai@emptydomain.de>
To:        Daniela <dgw@liwest.at>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Beginning C++ in FreeBSD
Message-ID:  <87y8ouscfq.fsf@emptyhost.emptydomain.de>
In-Reply-To: <200404162241.56535.dgw@liwest.at> (dgw@liwest.at's message of "Fri, 16 Apr 2004 22:41:56 %2B0000")
References:  <200404151110.i3FBAaoo048373@adsl-68-76-19-75.dsl.klmzmi.ameritech.net> <200404161720.37041.dgw@liwest.at> <87pta73bs2.fsf@emptyhost.emptydomain.de> <200404162241.56535.dgw@liwest.at>

next in thread | previous in thread | raw e-mail | index | archive | help
Daniela <dgw@liwest.at> writes:

> On Friday 16 April 2004 20:31, Kai Grossjohann wrote:
>> Daniela <dgw@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.

What I was trying to say is that using C as an intermediary language
reduces effort.  Of course it is /possible/ to do the optimizing
yourself, it is just more work.

I think that "reducing effort" is a pretty damn good reason for doing
something in a specific way.  I hope that answers your "why the hell"
question.

> BTW, when I need somthing optimized, I'll do it in assembly anyway.

*cough*

Kai



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87y8ouscfq.fsf>