Best C/C++ compiler

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
User avatar
Zacariaz
Member
Member
Posts: 1069
Joined: Tue May 22, 2007 2:36 pm
Contact:

Best C/C++ compiler

Post by Zacariaz »

Ive desided not to make a vote as i probably dont know half of those in existence.
A few rules though, OS independency, meaning that the compiler have to be avalible for for at least windows and linux. Also it has got to be freeware, opensource, whatever...
Free it has got to be!

A short discribition including pros and cons and stuff would allso be nice.


Regards
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

Few hints about possible winners:

GCC for obvious reasons

ICC (Intel C++ Compiler) - Fast, windows + linux, good code generation, free to use for non-commercial (and possibly also commercial) but not open source

Metrowerks Codewarrior - No clue, just well-known for being pretty good

Comeau C++ - Not all that known but the first C++ compiler to support export, so it must have its merits.


My vote is for GCC because of ubiquity, ease of use, clear error messages (apart from templates - but that's being worked on in the language and the others are even worse) and speed. It's also very good at guessing what I'm trying to do instead of what I type so at times I type some 100 lines of code and it optimizes my handy syntactic sugar to 4 lines of assembly.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

I can name a few that I know... but haven't used for OSDev..

The following should be are Open Source.. or at least have source available..
http://fabrice.bellard.free.fr/tcc/ - Tiny C Compiler - Open Source/Portable.
http://www.cs.princeton.edu/software/lcc/ - LCC - A Retargetable Compiler for ANSI C.
http://tack.sourceforge.net/ - The Amsterdam Compiler Kit - It's based off of the BSD licenced Minix C compiler.
http://www.tendra.org/ - BSD licenced C/C++ compiler... neat project..
http://nwcc.sourceforge.net/ - Nils Weller's C compiler - Another BSD licenced C compiler...
http://www.cpm.z80.de/small_c.html - Small C - It's a common C compiler... It's old though..
http://retro.tunes.org/simplec/ - Simple C - Port of Small C for Linux..

I'm sure you could find a few other smaller projects, The big one your already know about ;).. http://gcc.gnu.org/

The many proprietary/freeware compilers shall remain nameless :D
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

I think it depends on where you ask - the majority here uses GCC for it suiting the purposes of OS development. If you'd ask a regular windows programmer, you'd probably hear Visual C as being the best compiler. (not that it qualifies for the purposes here.)

If you ask at the right place ICC may very well be the most likely answer.

Of the compilers I have tried that meet the criteria, nwcc didn't compile under cygwin, leaving GCC as the only alternative. (I did try installing lcc once, but since that box had less than 30 mb free that obviously didn't work out)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
elderK
Member
Member
Posts: 190
Joined: Mon Dec 11, 2006 10:54 am
Location: Dunedin, New Zealand
Contact:

Post by elderK »

Does the Intel compiler have any serious advantages over GCC?

~Z
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

Combuster wrote:I think it depends on where you ask - the majority here uses GCC for it suiting the purposes of OS development. If you'd ask a regular windows programmer, you'd probably hear Visual C as being the best compiler. (not that it qualifies for the purposes here.)
C++ programmers that use the language rarely answer Visual C++ as their preferred compiler as it contains a number of flaws and errors that make using C++ with it harder than is necessary. I haven't used the bottom of the options in C++ and I've been hit by a compiler bug in VS2005 already, so it aren't even just the unlikeliest cases.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

I found another compiler, I'm not sure about licencing.. but the source is available.. supports many processor architectures.

http://www.compilers.de/vbcc.html - vbcc - portable ISO C compiler..

I'm done searching, but I though it was worth trying to index a few of them 8)
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

zeii wrote:Does the Intel compiler have any serious advantages over GCC?
Last time I looked, ICC generated much more efficient code than GCC (~20% better). However, that has been quite some time since, and GCC 3.x. AFAIK, one of the goals of GCC 4.x was to rectify this, I don't know how successful they were.

Oh, and I'd like to stress that the EDG / Cameau compiler is the only fully compliant C++ compiler available. Funny thing: The EDG was adamant in their resistance against including "export" in the C++ standard, yet still they're the only ones that implemented it in their compiler...
Every good solution is obvious once you've found it.
niteice
Member
Member
Posts: 59
Joined: Tue Oct 03, 2006 3:49 pm

Post by niteice »

ICC generates better code, but some very fine-tuning of optimizations cause it to (automatically) fail on non-Intel processors. 90% of code will probably never reach that point, though.

Also, ICC reportedly uses the EDG frontend, so it may be the second fully compliant C++ compiler. :D
User avatar
kataklinger
Member
Member
Posts: 381
Joined: Fri Nov 04, 2005 12:00 am
Location: Serbia

Post by kataklinger »

1. Intel C++
2. MSFT VC++ (7.0+)
3. all others
ICC generates better code, but some very fine-tuning of optimizations cause it to (automatically) fail on non-Intel processors. 90% of code will probably never reach that point, though.
I read somewhere (and saw tests) that in fact ICC generated code is executed faster on AMD's processors then code generated by other compliers in most cases.
niteice
Member
Member
Posts: 59
Joined: Tue Oct 03, 2006 3:49 pm

Post by niteice »

I'm not surprised. However, what I was referring to was a small processor check at program startup that automatically terminates if the machine doesn't have at least a specific model of Intel processor (generally a feature set such as SSE3).
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

niteice wrote:I'm not surprised. However, what I was referring to was a small processor check at program startup that automatically terminates if the machine doesn't have at least a specific model of Intel processor (generally a feature set such as SSE3).
I remember reading that Intel's C/C++ compiler generates code that deliberately "favours" Intel Processors..

http://www.swallowtail.org/naughty-intel.html

According to that article it was eventually "fixed" in newer versions... but it's still interesting...

I'll stick with GCC ;).. hopefully the BSD licenced C compiler that was imported into OpenBSD improves as well 8)
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
dengll23
Posts: 3
Joined: Sat Sep 22, 2007 9:04 am
Location: WuHan/China/Asia
Contact:

Post by dengll23 »

I only have used the Visual C++... :cry:
I am a student from China. My English is not very good, but I will study hard.
Post Reply