[comp.lang.c++] different compilers

ssr@courant.Princeton.EDU (Steve S. Roy) (06/05/89)

Hi gang.

I just signed on recently and I have a couple of questions about getting
a c++ compiler.

It looks like there are two main compilers people are talking about:
GNU G++ and AT&T cfront.  How interchangable are these?   If I were to
write and debug a code with GNU G++, could I rely on then piping it thru
cfront to move it to a machine that G++ doesn't run on?  Do the recent
postings on 2.0 mean anything about G++?  If I were to follow the allocation/
construction/destruction/deallocation guidelines just posted here will it be
portable between compilers?

Second, I know how to get G++, but how does one get cfront?  How much does
it cost?

TIA

Steve Roy

----------------------------------------------------------------------
Real Name: Steve Roy
e-mail: ssr@courant.princeton.edu
telephone: (609)452-5384 (office)
           (609)466-4225 (home)
Address: office:
         Program of Applied and Computational Mathematics
         Princeton University
         Princetion NJ 08544-1000

jima@hplsla.HP.COM (Jim Adcock) (06/06/89)

> It looks like there are two main compilers people are talking about:
> GNU G++ and AT&T cfront.  

Well, also the Zortech C++ compiler for the PC world.  I have had no exposure
to the Zortech C++ compiler, so I can only talk about g++ and cfront.

> How interchangable are these?   

Depends on what you mean by interchangable.  Many programs written that
compile and run successfully under cfront compile and run successfully under
g++.  Cfront and g++ come with different libraries, with different capabilities,
and different naming conventions, so as to make use of libraries for one
generally unusable with the other.  Maybe if one was clever one could write a 
utility that would change the name encryption scheme used in one compiler's 
binary output to match the name encryption scheme used in the other's binary 
output.

Any chance of getting compiler writers to agree on one name encryption scheme???

BUT -- to me the biggest difference in these compilers is in how they handle
[or rather-- don't handle] inline functions.  The AT&T compiler typically 
seems to try to respect a user's request for inlining functions -- though
maybe one in ten functions I request inlined causes the compiler to
squawk and generate a function instead.  The Gnu compiler generates a 
function for every inline function defined, though it may also try to inline
this function where called.  In my experience this typically makes libraries
compiled under Gnu about twice as big as AT&T.  It also typically means the
AT&T code is faster -- using the AT&T cfront followed by the Gnu vanilla
C compiler "gcc" seems to generate particularly good code.

Other than this inlining issue, I find that for many methods AT&T cfront
followed by gcc generates essentially the same machine code as g++.

> If I were to write and debug a code with GNU G++, 
> could I rely on then piping it thru cfront to move it to a machine that 
> G++ doesn't run on?  

Depends on what you mean by "rely".  If you're serious about having your code
running on a variety of machines, I would have both a AT&T and Gnu compiler,
and develop my code under both.

> Do the recent postings on 2.0 mean anything about G++?  

I believe G++ is planning on tracking the "rumered" [sic :-] features of
2.0.  AT&T seems to have no interest in tracking the "enhanced features"
of G++ -- like named return variables -- which may or may not be unfortunate.

> Second, I know how to get G++, but how does one get cfront?  How much does
> it cost?

Try getting a version of "cfront" [more formally, one of many ported versions
of the AT&T C++ compiler] from your computer vendor, since if you can get it 
there -- its already ported.  Also many versions exist for the pc world.
Costs vary -- source or no source being probably the biggest determinant.
"Journal of Object Oriented Programming" carries many C++ ads.  Also, you
can contact AT&T about C++ through their Unix number [I forget it, but it
has been posted]

leech@Apple.COM (Jonathan Patrick Leech) (06/06/89)

In article <6590139@hplsla.HP.COM> jima@hplsla.HP.COM (Jim Adcock) writes:
>Any chance of getting compiler writers to agree on one name encryption scheme???

    Better yet, just use the fully scoped/prototyped name.
    Jon Leech (leech@apple.com)
    Apple Integrated Systems
    __@/

yair@tybalt.caltech.edu (Yair Zadik) (06/07/89)

In article <6590139@hplsla.HP.COM> jima@hplsla.HP.COM (Jim Adcock) writes:

>I believe G++ is planning on tracking the "rumered" [sic :-] features of
>2.0.  AT&T seems to have no interest in tracking the "enhanced features"
>of G++ -- like named return variables -- which may or may not be unfortunate.
                ^^^^^^^^^^^^^^^^^^^^^^

What are named return variables and what are they used for?  Could somebody
discuss any other features of G++ which wouldn't be mentioned in the standard
C++ references?

			Yair Zadik

yair@tybalt.caltech.edu

schmidt@ics.uci.edu (Doug Schmidt) (06/07/89)

In article <10933@cit-vax.Caltech.Edu> yair@tybalt.caltech.edu.UUCP (Yair Zadik) writes:
++ What are named return variables and what are they used for?  Could somebody
++ discuss any other features of G++ which wouldn't be mentioned in the standard
++ C++ references?

If anyone would like a copy of the g++.texinfo documentation please 
send me a note and I'll email it to you.  This describes the
G++ extensions to the C++ language.

Make sure you provide an address our mailer can understand!

thanks,

        Doug
--
Any man's death diminishes me,              | schmidt@ics.uci.edu (ARPA)
Because I am involved in Mankind;           | office: (714) 856-4043
And therefore never send to know for whom the bell tolls;
It tolls for thee        -- John Donne