Re: gcc versus cfront (AT&T)

jbuck@Synopsys.COM (Joe Buck)
Thu, 10 Nov 1994 18:51:23 GMT

          From comp.compilers

Related articles
gcc versus cfront (AT&T) jho@imada.ou.dk (1994-11-09)
Re: gcc versus cfront (AT&T) jbuck@Synopsys.COM (1994-11-10)
Re: gcc versus cfront (AT&T) sastdr@unx.sas.com (1994-11-11)
| List of all articles for this month |
Newsgroups: comp.compilers
From: jbuck@Synopsys.COM (Joe Buck)
Keywords: C++
Organization: Synopsys Inc., Mountain View, CA 94043-4033
References: 94-11-037
Date: Thu, 10 Nov 1994 18:51:23 GMT

jho@imada.ou.dk (Jens H. Ovesen) writes:
>Just one (maybe not so simple to answer) question: What are the pros and
>cons of gcc and cfront from AT&T?


gcc is a very good C compiler. It is not a very good C++ compiler.
I will use "g++" to refer to the C++ part of gcc, as is common.


My background: I maintain the FAQ for the gnu.g++.help newsgroup, and
have used both g++ and cfront extensively.


In some respects g++ and cfront have much in common. They are the two
buggiest C++ implementations available. However, both are available on
a very wide variety of platforms, so once having worked around the bugs
you now have a very portable program.


g++ has more bugs. But g++ implements more of the language than cfront
does; porting a program developed under g++ to cfront will probably result
in a certain number of "sorry, not implemented" messages from the
compiler, sometimes for surprisingly basic things (predating templates).


cfront doesn't support exceptions and probably never will do a decent job
of them, since it's been shown (paper in the 1992 Usenix C++ Conference
proceedings from an HP author whose name I forget) that going to C as an
intermediate language necessarily imposes large costs for an exception
implementation even for code that doesn't use exceptions. g++ doesn't yet
do exceptions either (there is an "alpha" implementation for SunOS).


There are dozens of C++ compilers that are superior to either of g++
or cfront. If the quality of g++ disappoints you (it should) you should
investigate other alternatives. Almost everyone (Borland, Sun's new
compiler, IBM, DEC, HP) has done a better job than either of these
compilers; most implement exceptions. Many vendors who used to sell
cfront ports have abandoned them for a superior native compiler (Sun
is one recent example).


g++ is good enough for many types of research work, and has the advantage
that the compiler is widely available. But if you can't cope with the
quality problems, I don't think that you'll find cfront to be enough of an
improvement.


cfront served an important purpose in the early days: as it produced C
output, it was widely portable and got the language into wide use.
But there's a very good reason why other compiler vendors aren't taking
this route (I know of only one C++ compiler other than cfront that
goes to C, and it is an obsure one).


--
-- Joe Buck <jbuck@synopsys.com> (not speaking for Synopsys, Inc)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.