Comparing Linux C and C++ Compilers
ChaoticCoyote writes "I've posted a comparison of recent GCC versions (3.3, 3.4, and the coming 4.0) with Intel C++ 8.1, including several benchmarks and "state-of-the-product" reviews. The new article replaces an older piece I published in late 2002. This
new comparison marks what I hope will be an ongoing series that tracks the quality of Linux compilers."
well, GCC has one thing going for it - it's open source - and that's why I'm sticking with it. XD
FP?
Moll.
What you hear in the ear, preach from the rooftop Matthew 10.27b
Interesting. Something I don't understand, though, is why the article talks about both gcc version 4.0 and "the upcoming-3.5"; will there be a 3.5 version before 4.0, or is that simply a typo?
quidquid latine dictum sit altum videtur.
by default, gcc (with a .c or lang-spec set to c)
let's you forget the #include, and the missing return value
Not bad. Not bad at all. Hopefully this will indeed spur development and add some competition to the otherwise small compiler market. :)
US businesses that currently accept chip and PIN/signature
That doesn't seem right; I know that Gentoo is able to adapt itself to your hardware, but this is a bit much for me to swallow.
my sig's at the bottom of the page.
Learn something every day--thanks :).
CEE5210S The signal SIGHUP was received.
Does the Intel compiler support any other chip architectures other than Intel architectures?
Hmm?
My other car is a slashdot UID.
At work we (well, I admin and made the call) reverted from the 8 series of intel to the 7 series because of some issues with fortran 90 compilation, but I hadn't noticed the 8.1 release. I'll have to give it a shot...
Interesting that ICC seems to create consistently quite large binaries in comparison to GCC.
Even if the Intel compiler is faster, it's best not to get in the habit of becoming locked into any proprietary platform. How likely is it that features on which one could come to depend will be kept available on free platforms, much less future processors not made or controlled by Intel?
CEE5210S The signal SIGHUP was received.
32 bit intel binaries will run on an Opteron and will probably give some gain as seen here at Aces.
Aces article
Im sorry, but in my mind anything this guy puts out is invalid. He is using a 64bit distrobution on a 32 bit chip? He is using something designed for an AMD64 chip on an Intel chip?
I hear people complain about gnu C++ alot because its not as good as commercial compilers.
However from what I see is the performance of the compiled code is the same with the exception that the resulting binaries are alot bigger.
Maybe gcc is good on x86 but sucks on other architectures? I know the Sun and SGI geeks have complained for years that gcc does not run well on their platforms compared to expensive alternatives by their vendors.
Has anyone run ICC and VC++.net on Windows? How does it compare to Borland and MS compilers under Windows2k?
http://saveie6.com/
I think the author had better mark the tests whose inner loops have been vectorized, since while some algorithms are easily vectorizable, some are not, so the performance of both are interesting. After all, we care most about the features (such as automatic vectorization) of the compiler, while benchmarks only very roughly reflect the existence of such features, the applicability of them, and their effects.
For the people here not getting his point:
AMD64 kernel
Intel P4 processor
Sure you can compile for AMD64 for if you like, but if your processor is an ordinary Intel Pentium 4 you probably won't be getting many benefits from doing so.
As some of the more insightful people have pointed out, there is a difference between mcpu=x86-64 which will make optimaztions assuming amd64 architecture (which is just silly, as you'll get no gains from it on a Pentium chip), and march=x86-64 which breaks binary compatability and just won't run on a Pentium.
So, either he's stupid and optimized for a CPU he doesn't have, or he is horribly incorrect about that configuration he specified, because it wouldn't be running. Take you pick.
I hope that clarifies things.
Jedidiah.
Craft Beer Programming T-shirts
Yes, I was hoping to see some PathScale results.
It's important to remember that open source projects often contain significant internal competition, even if they're monopolies like GCC or Apache.
One of the main reasons I was looking forward to the new GCC versions was faster compile times for C++. Yet it seems that for povray (the only c++ source in the benchmark), the compile times consistently get worse with newer versions of gcc. Does no-one care about people who actually compile kde?
Actually there are. LCC and TinyC come to mind. They're not used much in production [well LCC was reborn as LCC-Win32 for a while] but really GCC is the better choice.
:-)
The problem with the "good old days" was that as my friend Dave Dunfield said once "C compilers are a dime a dozen".
Just because you had a dozen C compilers for your 8086 doesn't mean you were better off. In fact most compilers for the 86 were crap [e.g. smallC, byteC, Zortech, paradise, etc...]. In fact the only half-way decent 86 compilers I recall are Turbo C [v3.01 was ok] and Micro-C [by Dave Dunfield so maybe I'm a bit biased there...].
Note I'm not saying more compilers is bad. The problem is like any field "new" doesn't imply better. You have to tackle problems and answer them.
For instance, GCC is rather large and can be slow/memhog on some files [C++ in particular]. A viable competitor for Linux would be one which optimizes decently while not being such a hog. It could pitch in when you can't build a file [say from VisualBoyAdvance which requires ~1GB of ram to build with GCC 3.4.2]...
For the most part though, contributing to GCC makes more sense than writing your own compiler. First off, GCC is a "standard". So you're likely to get a huge audience that way. Second, GCC is already well established. It's a very good suite of tools and frankly hard to compete with. Third, you'll save a lot of time.
For all intents and purposes you could change your argument to why do "linux" boxes only run the Linux kernel? I mean for all intents and purposes you could write your own kernel that was interoperable and use instead. For the same reason why contributing to GCC is a good idea so is contributing to the kernel [instead of writing your own] is a good idea.
One last caveat before I send this post. I do agree though that writing such said tools [kernels or compilers in this case] are a good idea for educational purposes. It means a lot to know how to write a functional [and ideally half-way decent] compiler even if it only targets one platform and covers only part of a language.
phew...
Tom
Someday, I'll have a real sig.
The basic point, simplified, is that the 533MHz FSB Pentium 4 chips don't have EM64T (a.k.a. AMD64, x86-64). Some of the latest Prescott-based chips do have EMT64T, but not the tested equipment.
For the OS/2 platform, there were compilers from Microsoft, IBM (C/Set and C/Set++), Watcom, Borland, Lattice, EMX/GCC, and probably a few more that I don't remember...
It would be nice to have more of a selection under Linux.
Why all the comments that are vehemently pro-gcc? It reeks of a defensive posture when none is necessary. The man is trying to conduct a semi-scientific test. Isn't /. about science and truth and news for nerds that transcends the tripe in the mainstream media? If so, why the instant hostility?
That's most likely because the market for compilers has become more mature. There are usually fewer players left in a mature market than in a new one. It doesn't necessarily have anything to do with open vs. closed source.
I don't consider your message to be flamebait. There aren't many C and C++ compilers for Linux. Several companies make Fortran 95 compilers for Linux, but few seem interested in the C community.
All about me
Compilers for {Solaris, Irix, HPUX, etc} : {Sun's, SGI's, HP's, etc's}, gcc
Compilers for Linux: gcc, icc, and Portland's pgcc.
Compilers for Windows: Microsoft's, Borland's, icc, gcc-mingw
Most modern OS's, not just Linux, don't have much in the way of compiler choice.
You can tell this guy is a nerd, but it goes far beyond the pizza and mountain dew... Is that really an empty tub of frosting sitting my his computer??
Billy Gates is asking why a comment insulting open source was modded -1?
This is a classic...
My post wasn't flamebait at all -- just my observation. I think what it boils down to is the fact that gcc is just "good enough" to get the job done for most people -- even if it doesn't generate the best code, or the fastest executables. People use it because its free. A significant number of Linux users _are_ Linux users because they believe in open source (i.e. "I have the right to free software"), and aren't the types that will spend a thousand $$$ or two for a top-of-the-line compiler.
Since people aren't willing to pay for a good compiler for Linux, no one writes one for Linux (Intel is an exception, because they're interested in showcasing their chips).
When I first wrote reviews for the early geek magazines (anybody remember Microcornucopia?), I could cover a dozen or more compilers for DOS. Today, the field is very thin. :(
All about me
I don't think maturity is the issue here. Was there _ever_ a time when Linux had a large selection of compilers that were eventually whittled down to just gcc and Intel's ICC?
Somehow, I think it's pretty much _always_ been a one-gcc show on Linux.
The article seems to be rather narrowly from a computer hobbyists' point of view.
It fails to point out that compile times are a fairly critical factor in programmer productivity. Yes, we should care that compile times with the Intel compilers look to be over 25% shorter than with gcc on average. (very rough eyeball estimate)
I am amused, also, at how perplexed the author seems that IBM would ship Eclipse 2.x (and CDT 1.x, its associated C/C++ plugins) with the compiler. The CDT plug-ins for Eclipse 3.x were only ready a couple of months ago, so this is plainly a matter of how much time and money the Intel team had to test them with ICC. Or maybe they weren't available yet at all: when WAS the Intel 8.1 compiler released, anyway?
For Windows, you can get C compilers from Microsoft, Intel, Borland (they're far from dead) and IBM -- and Watcom's compiler is still around as open source and being maintained as Open Watcom. The first four are major commerical offerings, which is a whole lot more choice than what you'll get on Linux.
Well, world consists not only of users but some people also develop stuff that you run. And for them compile times are also very important.
Oops, Intel's name for x86-64 is EM64T, not EMT64T.
GCC is not perfect and is designed to be portable. Its a no brainer.
Also gcc may be finally ready for x86 but lag on other platforms. This is obvious since 99% of the developers use x86.
But really the reason why there are no commercial c++ compilers is because gcc was there from day 1 and judging by the benchmarks may be good enough for prime time.
OS/2 and Dos had none so vendors came in to fill that niche.
http://saveie6.com/
The OpenBSD team use it, and I think they know better than you or I.
Not by technical choice, they want to use plan9's C compiler but have licence quibbles.
Quoting Theo : "in particular we were interested in the c compiler"
There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
As far as lagging on other platforms... For my development work on Solaris, it is quite interesting to compare the speed of my program using Sun's compiler vs. gcc (gcc is _way_ behind)
I find it interesting that there are only two C/C++ compilers available for Linux, as compared with seven Fortran 90/95 compilers (soon to be eight with the release of GCC 4.0). This not only dispels the myth that Fortran is a dead language, it also suggests that there is much more of a competitive market in compiling numerical code, than in producing other types of software.
Tubal-Cain smokes the white owl.
Look at the DOS/Windows compilers. There used to be several commercial offerings, including Microsoft, Borland, Watcom, etc. Now just about nobody is left trying to sell a compiler for Windows as an end in itself. Microsoft makes a compiler to help people stay locked into the Windows ecosystem. Intel makes a compiler to help people stay locked into X86 (they focus on raw performance so that X86 can run a few percent faster, helping to keep people from bolting to other architectures). There's a port of GCC to help promote Free software.
Most of the other commercial offerings were eventually frozen and offered as a freebie novelty on the websites of whatever company ended up with them when the music stopped.
The only reason that you have slightly more choice in still-under-development compilers on the Windows platform is that the players left in the game have ulterior motives that they're pushing.
One thing that the article doesn't focus on, but is also an issue for developers is the effect of actually using the compilers in a realistic development environment, where you have to integrate code from several vendors.
I write code for a large enterprise software company, and was investigating using the Intel compiler. More specifically, I needed to use Xerces, Xalan, and ICU, and Xerces and Xalan come with pre-compiled binaries that are compiled using the Intel compiler.
I started investigating, and one of the major hurdles I ran into was that Intel's CRT, libcxa.so has issues when linking several shared libraries that themselves individually link to different versions of libcxa.so.
For example, DB2's client libraries are evidently compiled using Intel's C++ compiler, but our DB2 client libraries were using a relatively old version, I think version 3. The Xerces libs were compiled using an newer version of Intel's compiler, I think version 5 or 6. When I tried to link my entire binary, I ran into run-time issues where the expected libcxa.so's conflicted.
We ended up ditching the entire thing and compiled Xerces and Xalan ourselves using gcc.
The other issue, of course, is what is our rights to distribute libcxa.so? I figured the entire thing wasn't worth it.
However, the Intel compiler did generate much better warnings and errors and in general felt much more polished. It wasn't for us, but it's something that should definitely be investigated if you want something that is commercially supported.
Then why does Borland continue selling a C++ compiler? I don't think they have any ulterior motives there -- they just want to sell their software...
Good points.
I've had problems using Intel to integrate existing libraries. As of version 8.1, the binary compatibility is supposed to be better, but I haven't had a chance to apply it to a really big project. In all fairness, GCC has had some similar problems with the C++ ABI at times.
All about me
TCC (tiny c compiler).
Compaq Alpha C compiler.
OpenWatcom C/C++ compiler
TenDra C/C++ compiler
egcs compiler (which merged into gcc- they saw that it had some advantages.)
ChEmbeddable
Cint c/c++ interpreter (not exactly a compiler)
CC65 Commodore C compiler
Absoft C/C++ Fortran compiler
lcc
These all run on linux. Some are open, some are not. GCC is used mainly because it is portable to just about anything-- so there goes your argument of GCC restricting choice. GCC exists to promote choice, and it does this.
Take your code written for Visual Studio and compile it on Sun. Can't do that with Visual Studio? No MFC on Sun? Your best bet will probably be good old GCC with WINE. So how are you restricted by gcc?
Now, if you want to make a cross compiler to compete with gcc- one with seperate front ends and back ends, so it can accept multiple languages, and can compile to just about every machine on earth-- then nothing is stopping you. Oh, what is that? Not interested. Neither is anyone else. Programers see no need to duplicate something that has been done well the first time. One good cross compiler is enough- GCC represents a NATURAL MONOPOLY.
...does not apply to GCC. Never has. And it will not in the future, unless we radically change the way we do development and releases.
3.4 follows 3.3 follows 3.2, and none of them were singled out as "developmental" or "experimentalal" or "extra stable". The experimental-vs-stable changes all take place before any release branch is made. There's more info on the website if you want.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
I've been developing in C++ with gcc 3.3 for some time, and just moved to 3.4 for some testing. Thank god for unit tests. There's some bitop-heavy code that gets miscompiled with full optimization (-O2). In the process of trying to debug these (I'm not prepared to assume that they're the compiler's fault, it could certainly be my code invoking implementation-defined behavior,) I managed to get the compiler to choke with the -fschedule-insns flag with 'no free register' errors.
In short, I don't have much confidence in the optimizer in 3.4. I'm trying to condense the problem to a testcase right now to submit a bug report.
Both Coke and Pepsi. What's the benchmark on those?
Analogies don't equal equalities, they are merely somewhat analogous.
Borland's focus is their IDE, not their compiiler. They give their compiler away for free, if you check their website. BC++ isn't a very good compiler, but people put up with it for the nice development tools.
A deep unwavering belief is a sure sign you're missing something...
Sun's C compiler is not a drop-in replacement for GCC - due to Sun's compiler not having some of GCC's -um- interesting features.
A Shadeless room is a brighter room.
Seems to me, you don't test the speed of a compiler on number crunching programs -- they are likely to have hand optimizations in them, and can benefit from hand optimization a lot more, so the compiler isn't as important in these applications since if you want real speed you write a core in asm.
He should have tested code that contains a lot of tangled up complex loops switches and jumps. Like libperlre's parsing and execution speeds. That and some really horribly over-abstracted C++ code where 15 classes are used just to add two numbers together.
(Perhaps the best test would be to compile a second copy of one version of gcc, and see how fast that can compile itself afterwards.)
Someone had to do it.
The standard C++ compiler itself can be downloaded for free. The ulterior motive, IIRC (I'm kind of rusty on Borland's products), is to push Borland Builder, which tries to turn C++ into some kind of value-added nonstandard RAD environment. Once again, the vendor's goal is lock-in.
On Linux, you've got:
Intel C++, GCC, TenDRA, OpenWatcom, and Portland Group C++. Sure, only two of those are commercial, but is it news that Linux has less commercial software than some other OSs?
A deep unwavering belief is a sure sign you're missing something...
Other rags from that era: Microsystems, Interface Age, first 10 years of Byte (Circuit Cellar is still a decent rag).
A Shadeless room is a brighter room.
Comeau has contacted me by e-mail, so they'll likely be included in future updates.
All about me
So folks, please recompile everything to take full advantage of the improved binary compatibility !
Most of the compilers you list are not serious contenders. OpenWatcom is planning, but does not yet distribute, a Linux compiler. I found no mention of Linux on the lcc web site. I don't have an Alpha anymore, so the Compaq compiler is not pertinent. I don't have a copy of the Absoft compiler, even though I requested one for review. An interpreter is, as you note, not a compiler. And so on...
All about me
Portland Compiler Group has a compiler that's fairly decent and optimizes for both AMD64 and Intel 32-bit (although they're pushing the AMD64/clustering angle right now).
It's nice, but much less free. 15-day free trial. Prices are not bad, but it's still a little steep, even for an academic license.
This is not a plug... just in case anyone was wondering if there was something besides ICC you could try in to benchmark GCC on something that ICC can't cope with.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
Another thing to try--LLVM can use g++ as a front-end to compile C++, and can often do further optimizations to speed things up even more. LLVM also has a C back-end, so you can benchmark other C compilers against each other too!
:)
Of course, the real fun will begin when it has completed Java and C# front-ends.
pb Reply or e-mail; don't vaguely moderate.
Spurred by the article, I decided to give the Intel compiler a go. However, one stumbling block I've come across is that it doesn't seem to have a visual debugger. That is, idb is akin to gdb. I'm interested in something like gvd or ddd.
Does anyone know of a way to do visual debugging on the Intel compiler's code? (thoughts which come to mind: maybe the Eclipse environment? Maybe a gcc debugger, like gvd, would work on icc's code? Maybe there's another Intel product for visual debugging?)
I'm always perplexed by such comparisons. Specifically, everyone talks about how awesome ICC is for numerical stuff. Well, I have written a fair amount of C++ code for computational fluid dynamics, and, for my code, GCC has always beaten ICC by a fairly wide margin (typically, 50 percent or more). Perhaps it has something to do with the fact that my code makes heavy use of templates? I don't really know.
Also, in my experience, the C++ standard library that shipped with the previous versions of ICC just wasn't that good. Well, that may be a little harsh, but it was a source of considerable irritation to me that ICC's implementation of valarray did not even use expression templates (hello temporaries!). Yes, I know valarray isn't all that, but it is standard C++ (hence, in principle, code that uses it is portable). Once again, the GCC implementation was very much superior. This may be part of the reason why ICC now uses GCC headers.
(As an aside, I did roll my own implementation of valarray that uses expression templates. I tested it with both GCC and ICC, and GCC still won.)
I am now curious to test whether things are indeed better with ICC 8.1 (the last version I tested was 8.0). Maybe this time it will actually speed my code up rather than slow it down.
Watcom, which was one of the best compilers for DOS, OS/2, WIN, and NT as well as partial Netware support is now open source (openwatcom.org) and Linux support is being added.
Still a good compiler but showing its age somewhat.
Dave
https://en.wikipedia.org/wiki/Inverted_totalitarianism
Or, more specifically, you didn't think to check the facts of the parent post before assuming the author of the article was either stupid or horribly incorrect.
If you had actually read the article, you would have seen:
Corwin (Homebrew)
Gentoo AMD64 GNU/Linux, kernel 2.6 SMP
Dual Opteron 240, Tyan K8W 2885
120GB Maxtor 7200 RPM ATA-133 HD
2GB PC2700 DRAM
Radeon 9200 Pro, 128MB, HP f1903 DFP
Tycho (Homebrew)
Dual Boot: Windows XP Professional
Gentoo x86 GNU/Linux, kernel 2.6 SMP
2.8GHz Pentium 4 w/HT, Intel D850EMV2, 533MHz FSB
2x80GB Maxtor D740X 7200 RPM ATA-100 HD
512MB PC800 RDRAM
Radeon 9200 Pro, 128MB, NEC FE990
Actually Watcom has been reborn as open sourced openwatcom. Current plans include a Linux version and fixes to work with configure scripts. See openwatcom.org.
https://en.wikipedia.org/wiki/Inverted_totalitarianism
Yes, the same kinds of monopoly-producing, winner-take-all effects exist in open source as in proprietary software. Few people recognize this.
But PathScale did get VC money to build a better C compiler, and for a niche market: AMD64 scientific computing. I guess it was pretty clever of them to freeload off SGI's open source code.
Compilers for Windows: Microsoft's, Borland's, icc, gcc-mingw
For Windows there are also
Digital Mars - used to be Symantec C++
LCC
Open Watcom
I think there are more for Linux also, like Visual Age
etc.
i can't name one piece of software for linux that was developed with codewarrior.
So, either he's stupid and optimized for a CPU he doesn't have, or he is horribly incorrect about that configuration he specified, because it wouldn't be running. Take you pick.
obviously someone needs glasses.
RTFA.
I quote:
Corwin (Homebrew)
Gentoo AMD64 GNU/Linux, kernel 2.6 SMP
Dual Opteron 240, Tyan K8W 2885
there you go, a dual opteron. duh?
i've seen increases of over 50% running the same 32bit code on an opteron in 32bit mode. there have been some fundamental architectural changes that make running 32bit code a lot faster than the equivalent p4 or athlon - changes that aren't due to l1 or l2 or on-die memory controller either - but rather fundamental changes with the way instructions are dispatched and processed.
Quoting the article:
Actually, the name of the license is the GNU General Public License. It is "General" because when the GNU project began there was no single license used throughout the project; .
GCC can be commercial too -- many firms distribute copies of GCC for a fee. I believe the author should have said "proprietary" meaning that what the Intel compiler program does, exactly, is secret. As RMS said when describing a proprietary web video streaming application he didn't want MIT to use to distribute a feed of his talk on copyright and globalization:
GCC, by contrast, is free software licensed under the GNU General Public License. Getting back to the article:
Here I don't think "open" was the best choice of words, I think "free" would have been more accurate. The GNU Compiler Collection was originally the GNU C Compiler and first written by RMS. I guarantee you that RMS did not and does not now do work for the open source movement. He makes effort to make that point clear (like when he corrected Mike Uretsky who made the same mistake). The FSF asks you not to lump their work in with the work of the open source movement. Eben Moglen spoke at Harvard some months ago and also made this distinction. Prof. Moglen makes it clear why they are so adamant on this point:
I don't think he's overstating the case.
Finally, there's a common misunderstood myth repeated in the end of the article:
Many people believe this, I've even heard a variant of this myth being repeated by a representative of the Mozilla Foundation. Choice is no substitute for software freedom, in fact they speak to different aims entirely and in computer software choice is not as important as software freedom. If all we have are three web browsers to choose from (say, Microsoft Internet Explorer, Netscape, and Opera) choice is satisfied. B
Digital Citizen
You missed PathScale, a compiler for AMD64 that supposedly generates absurdly fast code.
print "Yet another p{erl,ython} hacker\n",
You'll note that amongst the replies to the original post was a post from the author of the article, noting the error (apparently a typo) and saying he had now corrected it. I suspect you saw the corrected version (and I agree, it now is).
As for the amount of mod points my post got - who knows, mods on crack. I was just trying to write something useful for all the people who failed to note the original posters point. Check the immediate parent of my post if you're curious - there was some misunderstanding initially.
Sorry for any confusion.
Jedidiah.
Craft Beer Programming T-shirts
Regardless of benchmarks, I consider the nasty backwards compatibility issues of GCC a serious problem. Virtually all of my Linux tech support time over the last two years has been spent messing with libstdc++ or libgcc_s versions to get various software packages to run. The problem is exacerbated because these libraries in turn are coupled tightly to glibc and pthreads, leading to more versioning headaches. My #1 wish for GCC is to get these libraries set in stone and make them as independent of glibc/pthread versioning as possible. I really want to be able to install a random C++ binary and have it work the first time.
Also, the ability to compile a C++ DSO without requiring the exact same compiler version as the program that will load it, is a major need for commercial Linux software vendors.
Those are GNU's compilers, not linux's. Why do you take all the credits from GNU which was the oríginal developer of the system? By calling the whole OS Linux, people who hear it first time think that Linus started it all with his kernel and there wasn't anything before that. Please, GNU/Linux and GNU's compilers.
Current plans include a Linux version and fixes to work with configure scripts.
The "fixes" to work with configure scripts are auctually wrapper programs that accept the One True(tm) comman line switch standard for cc, ld and friends. Watcom has always been a very exotic development envirorment. wmake calls the toolchain as dlls, and the build tools have their own command line switch structure.
--- Justin Dearing http://www.justaprogrammer.net/ We're just programmers.
I was empirically analyzing the gcc 3.3.3 optimizer a couple of days ago. Some interesting points:
[argh...lameness filter refuses to allow source code]
I'm providing a link to my journal entry so that I can post these examples.
May we never see th
What is exactly the point of comparing gcc and g++?
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
Politics is holding GCC back once again ... FSF better pray LLVM doesnt get critical mass, or it will be EGCS all over again.
I am especially interested in GCC because I want to write a new front end (my own programming language). I don't want to mess with back ends, since I am not interested in that stuff; the linguistic part of the programming languages is far more interesting. But I can't find decent documentation anywhere on the internet for a GCC newbie. I tried looking at the source code, but it is an ugly mess of macros. The article of course mentions C/C++ only, but GCC is something more than that...I think it deserves a well written piece of how to extend it with new front ends.
IBM VisualAge C++ is also supported on Linux.
You might ask "why?" -- and the answer is the same as if you asked "Why are companies still selling Fortran compilers?": a whackload of existing, working code and a build environment that would cost mega-bucks to port to a new set of tools.
It would be interesting to see how VisualAge compares on ChaoticCoyote's benchmark. I hope IBM contacts him to get into the next edition of his benchmarks.
I always get confused about people claiming compile time is important for development. It seems to be people who make a habbit of compiling everything from scratch. Haven't they heard of make? To me, link time is the limiting factor. When I make a change, I have to compile just the file I changed, or maybe a handfull of files if I changed an interface. And then I have to link all 236 files, which is where the time is spend.
I can see it compile time being important to people who use the compiler as an install tool (like gentoo users), but not for any serious developers.
he does mentiont that the SciMark benchmark is only in C. Should I then assume that all the other tests are C++? Otherwise great article and I'd love to see more on the topic.
No, the point of Gentoo is not optimization, although it is certainly possible to use the distribution in this fashion. The main point is that Gentoo is a meta-distribution that lets you customize the setup every which way. Other distributions make package configuration decisions for you, whereas Gentoo allows you to make them yourself.
:)
Want ALSA support in everything? No problem. Want to disable KDE or Gnome for every package? No problem. Want to add IMAP and LDAP support to everything? No problem. All that is necessary is to set the USE flags.
Since Gentoo is more or less a bleeding-edge distribution, packages get updated frequently. Under these circumstances, compiler speed is far more important than every last bit of optimization, unless you are one of those power-user-masochists.
Are you sure there is a CodeWarrior for Linux? The only product I ever knew was an IDE for GCC.
Does anybody knows if icce 8.1 produces optimized
code for Opteron processors? How close is Intel's
extended memory 64 technology to AMD x86_64?
Does anyone know if it is possible to use one of the alternative compilers ICC , OpenWatcom or Corneau ? to build a linux system from scratch?
I would be truely intrigued at what overall performance might be like.
Electronic Music Made Using Linux http://soundcloud.com/polyp
1983 called and it wants its programming language back.....
All your base are belong to us!
I am currently working on neural simulations of the motor cortex. The machines I have for development are dual pentium IIIs - the production environment is 128 processor linux cluster. I have compiled my programs both with gcc and intel and have to say the pentium III sse compiler directives and loop optimizations appear to produce faster code (approx. 10% faster) using the Intel compiler. This means a lot on a real simulation (approx 30 hours).
So if your goal is to get code to run fast on Intel platform the Intel compiler may have it's advantages.
C++ has an implicit return EXIT_SUCCESS from main. The lack of a declaration for printf, however, makes this first post highly suspect.
XML causes global warming.
She INSISTS on Diet Coke... Only "full fat" Coke does it for me.... Rum is probably one of my favourite hobbies! ;-)
Time flies like an arrow. Fruit flies like a banana.
Nowadays LCC-Win32 is a very different compiler from LCC. Jacob Navia bought a license for LCC3.6 (IIRC) and has developed it independently since then. His version has lots of features (eg. optimizers, C99) not in Fraser's and Hanson's LCC. And then there's the whole win32 thing too.. (There is also a "rival" LCC for Windows written by a Swede, called Pelles C.)
Also Codeplay's VectorC (Windows, Playstation2), Metrowerk's CodeWarrior (just about any platform under the sun).
For embedded work there's plenty of cross compilers, most CPU vendors have their own toolchains etc. Many of these are special-purpose compilers and have only niche markets, but there are tons of compilers available overall.
Jesus. It's two clicks from the GCC front page: hit 'front ends' on the link list to the left, then the second link down, 'other links and readings'.
If you can't make it to the first line of the third paragraph in the front ends front page, you're probably not cut out to write a new front end, and it's a hell of a lot harder to write a GCC front end than it is to write a whole new compiler. Truth is, you really should be looking at YACC and BISON, not GCC at all. Go read Aho before you attempt anything further.
StoneCypher is Full of BS
I've read most of the material supplied in the links you have posted...it's inadequate. Sooner or later the frond end maker will be confronted with requirements from parts of GCC that are simply not documented anywhere and it is only the GCC developers that know. Most material is very superficial, and the most frequent comment is 'look at the source code files x, y, and z for more information'. The source code file is a mess of macros that one has to go deep in order to understand the outter layers. Instructions are not analytical (most of them say 'just place X and Y file in there' or provide functions a, b and c) without saying why. Obscure names 'like 'yylex()' and stuff don't really help.
And I don't need lessons on yacc and bison. I know very well how to write a compiler (scanner->parser->AST->intermediate language->assembly). My problem is how to apply that knowledge to GCC, because I don't want to re-invent the wheel.
When I say it is inadequate, I mean about myself. I don't have the time nor the appetite to read, decode and analyse line per line the work done by others, just because the is no decent documentation.
While we're picking appart semantics...
You can't really measure "quality" with a benchmark. This is really a performance comparison of compilers, rather than a quality one.
Quality is usually defined as the number of delivered defects in a product, in this case the compiler. The only "quality" measurement comes from the fact that one of the produced executables generated a segfault. We have identified a single fault in one of the compilers. This is hardly an adequate sample size to determine the relative quality of either.
Just out of curiosity: Which language where you actualy planning for?
Obscure names like 'yylex()' and stuff don't really help.
And I don't need lessons on yacc and bison.
I think you probably do need lessons on yacc and bison, if you think "yylex()" is an obscure name. It's the totally standard name for the lexer callback used in yacc and most of its clones. And the relevant section of the Bison manual is the third hit when you google for it -- so much for "no decent documentation"!
Methinks you could have chosen a better example...
If you don't want to mess with back-ends etc, why not get your program to spit out C code? Then compile that with gcc. I think that SmallEiffel started out this way.
Reality is defined by the maddest person in the room
Hey. I'm going to be real honest here. We're all techies right? You would last 5 us or less (and yes that is microseconds) if GCC was a crap compiler. RMS wouldn't forgive you. Your mother wouldn't forgive you. Shit. Don't even think of what Eric (the raymond) would do. He packs serious firepower (cowers under pine tree - hey at 2000+ miles even he can't hit me unless he really did get that tactical nuke). But, we know that the demons we love don't work this way. Honest. (checks the tactical nuke indicator ). Foo. Get a life. Or even an interest in something like Python. GCC is about the most seriously good compiler out there. It may not always make the most pretty code. It may not be friendly. But damn it. You know that if it breaks you can talk to the guy who (god help him or her) broke it. You'll never get that luxury with (cough) that compiler that is called CL. If you need to understand what OSS is. I just told you. Is it the best? Hey if you need to shave that extra something out then you ought to consider the quaint old fashioned roll up my sleeves assembly approach. Coughs and splutters (should really give up smoking) ---- I don't understand children that are scared off this stuff. It wasn't bad for my (oh serious pain in my chest here) H E A L
But when RMS started his idea for the GNU project none of us believed he was anything except a hippy wacko. Honest. Without *his* input there would be no Linux, No GCC , No EMACS (some might like this) and lord knows how many businesses couldn't have existed. Before Richard , software could cost so much you'd have to sell your grandmother. Don't ask the price of a Fortran or C compiler. Yes. This was the world of 1990. Not 1890. We owe a great debt to Richard. I for one have a fund specifically aimed at Beer for said people. One day, I hope to buy RMS a brewery....Hey, it's going to take some time but I figure that with a few helpful souls we could imagine doing this... A very long time ago a guy called P.J.Brown wrote a delightful book about software development that suggested that if you offered your customers a beer when they discovered a bug then they'd be motivated to find bugs. Don Knuth has a similar view with Latex (sorry about the absent subscript) I like such people. Hey I'm a techie. Gosh I'm running (or is that ruining) a company. Ouch. Honestly, there is no reason to get emotional about compilers. I used to have a friend who spat this stuff in his sleep (and yes, he came back from meeting Nicky in Zurich with a very big smile on his face). I have to say that in the real big wild west out we live in it doesn't matter. GCC is a good compiler. Period. It was a damn good C compiler even when it was 2.x.something. C++ (sigh). You want to play with that shit? Sorry, at CMU, who should know doesn't really like using it. Above all, (and since it's been a long time and most of you perhaps don't know) *DON"T PANIC*. Yes, the hitchhikers guide is back *tomorrow* on our very much beloved BBC. Have fun /.ers.
(don't slashdot them or I send my Greek friends
Italian friend who may or may not work for those
nice italian business people around to rearrange
your furniture).
I have to make this really stupid comment.
If I don't nobody else will. I once had the honour
and priviledge of working with someone who lived
and breathed compiler technology. It was a long time
ago. It was Modula-2. So what? It was TDI (yes, those
people in the old Atari ST days).
Now, my friend was a serious deep thinking man. When
he came back from meeting Professor Wirth (yes that
guy at ETHZ) he smiled a lot. You see, my old friend
Mr. P.C. (not joking those *are* his initials) managed to do some very very pretty things for the code generation of the compiler we had from those
splendid swiss people. John Coltrane would love
that name though...
Foo. You people are mere virgins. GCC is a good
compiler. Period. But that's like saying that
my light is a good illumination source. Doesn't help. If you're so desperate are you in fact asking the wrong question?
I know 'yylex' is a standard name of yacc. I just said that it is not descriptive enough of its function. It takes time to get used to it...that's a case with a lot of things regarding GCC. It feels like a hack; it's not a hack, but it makes the life of a newbie more difficult than it should be.