Which C/C++ Compilers do enterprises use on Linux? - c++

I have been using the GCC Compiler for months, which is great, and works very well. But I wonder which C++ Compiler do big/medium enterprises use for high optimizations/performance in Linux (x86, PowerPC...).
It may seem a very stupid question, but I havent found the answer anywhere.
As far as I know, the best PowerPC Compiler is the XL, but x86 I dont know anything.
EDIT: Thanks a lot for all the answers. They were all very helpful. You have convinced me to use GCC ;) Regards!

In the places I have worked we have always used gcc, even for embedded applications/software.
Performance improvements are much more likely to come from your code rather than your compiler choice anyway!

Intel sells its own compilers which are supposed to generate very performant code...at least on Intel CPUs.
The nice thing about ICC compared to GCC is that ICC uses EDG's C++ frontend, which means that it has better support for some advanced C++ features than GCC.

Everyone uses GCC - most Sun sites (for example) I've worked at replace their crappy Sun development tools (And boy, are they crappy) with Open Source ones like GCC.

For embedded PowerPC, check out the Wind River Diab Compiler.

Intel Compiler Collection, Sun ONE Studio, IBM XL C Compiler, Open64, Open Watcom, and of course GCC.
I presume some companies must be using Sun ONE & xlC for porting large projects as there is no reason why anyone would normally to use them.

EKOPath 4 Compiler Suite
https://github.com/path64/repositories
http://www.pathscale.com/ekopath-compiler-suite
PathScale is freely releasing the
source to the EKOPath 4 Compiler
Suite. EKOPath 4 is a high-performance
compiler that up until now has been
proprietary and costs nearly $2000 USD
per license, but now it's open-source
and can sharply outperform GCC in many
computationally-intense workloads.
The community indeed is excited for EKOPath now being open-source (GPLv3)

Related

GCC worth using on Windows to replace MSVC?

I currently develop in C++ on Windows, using Visual Studio 2010. After the official announcement of C++11, I have begun to use some of its features that are already available in MSVC. But, as expected, the great majority of the new changes are not supported.
I thought maybe the upcoming version of Visual Studio would add these new features. However, after reading this it looks like very little is going to change.
And so, I'm curious about the feasibility of using GCC on Windows rather than MSVC, as it appears to support the great majority of C++11 already. As far as I can tell, this would mean using MinGW (I haven't seen any other native Windows versions of GCC). But I have questions about whether this would be worth trying:
Can it be used as a drop-in replacement for cl.exe, or would it involve a lot of hacks and compatibility issues to get Visual Studio to use a different compiler?
The main selling point for Visual Studio, in my opinion, is it's debugger. Is that still usable if you use a different compiler?
Since GCC comes from the *nix world, and isn't native to Windows, are there code quality issues with creating native Windows applications, versus using the native MSVC compiler? (If it matters: most of my projects are games.)
In other words, will the quality of my compiled exe's suffer from using a non-Windows-native compiler?
MSVC has the huge advantage of coming with an IDE that has no equals under Windows, including debugger support.
The probably best alternative for MinGW would be Code::Blocks, but there are worlds in between, especially regarding code completion and the debugger.
Also, MSVC lets you use some proprietary Microsoft stuff (MFC, ATL, and possibly others) that MinGW has no support for, and makes using GDI+ and DirectX easier and more straightforward (though it is possible to do both with MinGW).
Cygwin, as mentioned in another post, will have extra dependencies and possible license issues (the dependency is GPL, so your programs must be, too). MinGW does not have any such dependency or issue.
MinGW also compiles significantly slower than MSVC (though precompiled headers help a little).
Despite all that, GCC/MinGW is an entirely reliable quality compiler, which in my opinion outperforms any to date available version of MSVC in terms of quality of generated code.
This is somewhat less pronounced with the most recent versions of MSVC, but still visible. Especially for anything related to SSE, intrinsics, and inline assembly, GCC has been totally anihilating MSVC ever since (though they're slowly catching up).
Standards compliance is a lot better in GCC too, which can be a double-edged sword (because it can mean that some of your code won't compile on the more conforming compiler!), as is C++11 support.
MinGW optionally also supports DW2 exceptions, which are totally incompatible with the "normal" flavour and take more space in the executable, but on the positive side are "practically zero cost" in runtime.
I want to add some information because the field may have changed since the question was asked.
The main problem for switching away from MSVC was the lack of a good IDE that flawlessly integrates with MinGW . Visual Studio is a very powerful tool and was the only player on Windows for quite some time. However, Jetbrains released a preview version of their new C++ IDE CLion some days ago.
The main benefit comes when working on cross platform applications. In this case, a GCC based tool chain can make life much easier. Moreover, CLion narrowly integrates with CMake, which is also a big plus compared to Visual Studio. Therefore, in my opinion, it is worth to consider switching to MinGW now.
GCC's C++11 support is quite phenomenal (and quite up to par with standards conformance, now that <regex> has been implemented).
If you replace your compiler, you'll need to make sure every dependency can be built with that new compiler. They're not made to be substitutable plugins (although Clang is working on becoming that way).
GCC is a fine compiler, and can produce code that has pretty much the same performance, if not better, than MSVC. It is missing some low-level Windows-specific features though.
Apart from this, to answer your questions:
To get VS to use GCC as a compiler, you'd pretty much need to turn to makefiles or custom build steps all the way. You'd be much better off compiling from the commandline and using CMake or something similar.
You cannot use the VS debugger for GCC code. GCC outputs GDB compatible debug information, and the VS debug format is proprietary, so nothing will change in that area anytime soon.
Code quality is just as good as you'd want it. See above.
No, the quality of your code will actually increase, as GCC will point out several assumed standard extensions MSVC would hide from you. All self-respecting open source projects can be compiled with GCC.
I my humble opinion, it's depends how someone started to code in the first place. I've been using g++ and gcc for more than 20 years now but the reason why i keep using gcc is mainly for licensing reasons. Although i like it too when i don't have a bunch of runtime dependencies or dll's to bundle with my stuff since i came from the DOS era, i still like my stuff small and fast. gcc for windows comes with standard win32 libraries and common control but i had to develop my own win32 controls for stuff that might require mcf shit to work properly or just to look nicer.
Although gcc might have strong support over internet, when it comes to win32 stuff, many rely on mcf and vc proprietary stuff so again, one may have to work his own issues around and be creative when difficulty arises.
I think it's all about needs and circumstances. If you are just a hobbyist coders and have the time for researches, creating you own libs and stuff but you want a solid compiler that's around since the late 80's and free, gcc sound perfect for the job.
But in the industry visual studio is a must if you want to be competitive and stay in the race. Many hardware manufacturers would prefer bundling visual studio compatible libraries for they hardware over some opensource gnu stuff.
That's my two cents.
To be honest, C++ should be handled with MS Visual Studio. If you want to make cross-platform or Unix apps, use GCC. GCC works and can be used with any IDE other than Visual Studio. Even Visual Studio Code can use GCC. Code::Blocks, Eclipse IDE for C/C++ developers, CLion, Notepad++ and even the good ol' tool we've always known, Notepad works with GCC. And finally, on a PC with low disk space, installing Visual Studio's "Desktop Development with C++" is something like 5 GB, if it was to be useful. And this is where GCC hits MSVC hard. It has native C support. MSVC can compile C, but only with a lot of fine-tuning. It takes a lot of time and effort to finally be able to compile. The final verdict:
If MSVC works, it hella works! If MSVC doesn't work, it HELLA DON'T WORK.
If GCC installs, it works, and if it doesn't work, it's the IDE's problem.
GCC is for people who don't mind spending 4 hours at the computer making it work properly. MSVC is for those who don't care about C and want it to install without any pokin' around.
It can't be used as a direct swap-out replacement for the microsoft compilers, for a start it has a vastly different set of command line arguments and compiler specific options.
You can make use of MinGW or Cygwin to write software but introduce extra dependencies ( especially in the case of cygwin ).
One not often touted advantage of gcc over cl is that gcc can be used with ccache to drastically speed up rebuilds or distcc to build using several other machines as compiler slaves.
Consider the Intel compiler (or "Composer" as they seem to have taken to calling it) as another option. I'm not too sure where its C++11 support is at compared with MS (certainly it has lambdas), but it does integrate very nicely with VisualStudio (e.g different projects within a solution can use the Intel or MS compilers) and there's also been some efforts made to match the MS compiler commandline options.
GCC and MSVC use different name mangling conventions for C++. C++ dlls compiled by one compiler can not be used in applications compiled with the other. I believe this is the main reason we don't see more widespread use of gcc in windows.

Is there any way to obtain antique versions of Borland's Turbo C++ compiler for free?

I am looking for an old version of the Borland Turbo C++ compiler. However I have to get it in legal way. Has anyone heard something about discounts for such old compilers?
[EDIT]
I would like to publicize my old sources for educational purposes, however they will only compile on this old compiler. I want to show my blog readers what mistakes they should try to avoid while learning a new language.
So It would be great if anyone could download the sources and compile them on their own computer. Therefore, I hope that maybe after so many years, Borland would give these old versions to the public for free...
Embarcadero, the company that now owns Borland's developer tools, gives away a lot of their antique software for free. Turbo Pascal 1.0, 3.02, and 5.5 are available, as are Turbo C 2.01 and Turbo C++ 1.01.
You can download the offerings here (the page is extremely slow, but it will load eventually).
And thanks to Alain Pannetier, who informs us that a slightly newer version, Turbo C++ 5.5, is also available as a free download.
But uh, if you're just looking for a freely downloadable C++ compiler, there are much better options, no time machine required. Check into GCC and/or Microsoft Visual C++ Express.
Are we talking about Pascal or C? There are freeware equivelents that I've used to compile ancient Turbo Pascal projects without a problem (FPK Pascal is one).
Ah, I miss pascal. And quiche.
here are two links for sites that sell old Borland software:
http://www.recycledsoftware.com/servlet/the-BORLAND-C-pls--pls-/Categories
http://www.emsps.com/oldtools/borland.htm
P.S. Why can't you compile the code with a newer compiler? Is it the C++ language
or the libraries you are using?
Jogy

How do I determine which C/C++ compiler to use?

I am trying to figure out which C/C++ compiler to use. I found this list of C/C++ compilers at Wikipedia:
http://en.wikipedia.org/wiki/List_of_compilers#C.2FC.2B.2B_compilers
I am fairly certain that I want to go with an open source compiler. I feel that if it is open source then it will be a more complete compiler since many programmer perspectives are used to make it better. Please tell me if you disagree.
I should mention that I plan on learning C/C++ mainly to program 2D/3D game applications that will be compatible with Windows, Linux, MAC and iPhone operating systems. I am currently using Windows Vista x64 OS.
First of all, IMHO as a beginner your development environment (IDE) matters a lot more than the compiler.
I think that people place too much emphasis on compiler choice early on. While it is not Java, C++ is meant to be portable.
If the program you're writing only works with specific compilers, you're probably doing the wrong thing or can work a little on making it more portable.
If you get to a point where compiler choice makes a significant performance impact for you, then you've already perfected everything else in your program and you're in a good state and you are also quite advanced in your abilities. We used to teach the differences between compilers at fairly advanced stages in the CS curriculum.
If you use a UNIX based machine (Linux, Mac, actual Linux), then pretty much GNU (g++) is the way to go and is fairly much standard. If it's good enough to compile your OS, it's probably good enough for you. On a mac you can use XCode as your IDE, and it interfaces well with g++. On Linux some people prefer command line tools, though you might like the Eclipse C++ support, it is much better today than it was 3-4 years ago.
Things on Windows are trickier. If you can afford it, have access to, or are eligible for one of the free editions (e.g., via a school), I think the Microsoft Visual C++ Environments (or whatever they are called now) are pretty good for learning and they are used in production. I think there's actually a lightweight visual studio now with an emphasis on C++ that could be a good start. If you don't, you can probably find a distribution of Eclipse that is specific for C++ and includes an implementation of the GNU compilers.
Use gcc and g++ while you're still learning these languages, a big enough task for now. If you need a specialized compiler down the road, you'll want to have much deeper understanding of the language and your problem domain to properly evaluate candidates.
I feel that if it is open source then it will be a more complete compiler since many programmer perspectives are used to make it better.
That's not necessarily true. You could also say that if you use Microsoft's compiler, it will be optimal for Windows, since Microsoft knows best how to optimize a compiler for Windows.
Microsoft has Visual C++ Express Edition which is free and ofcourse includes a nice IDE that's very well suited for Windows development.
But if you're interested in making portable software, look at GCC, which is the default compiler on Linux and which is also available on the Mac. (The iPhone works totally different and requires special tools that only run on Mac OS X). You can get GCC for Windows with Cygwin or MinGW.
Get the Visual Studio Express (easier and quicker IMO, to setup) and learn with it; when you think you know enough about C++ and how "things" work, you could start using something like QT or GCC (with cygwin) and learn to port to different platforms.
For windows u can use CodeBlocks I believe it uses gcc and its pretty user friendly
I strongly suggest going with MinGW.
It is:
Open-source
Available on all major platforms
Comes with standard Win32 headers and libraries
The key to writing portable C++ code is:
Use a cross-platform version control system (subversion is a great choice), because this makes it easier to
Compile and test your code on other platforms early and often

C++ compilers and back/front ends

For my own education I am curious what compilers use which C++ front-end and back-end.
Can you enlighten me where the following technologies are used and what hallmarks/advantages they have if any?
Open64 - is it back-end, front-end, or both? Which compilers use it? I encounter it in CUDA compiler.
EDG - as far as I can tell this is a front-end use by Intel compilers and Comeau. do other compilers use it? I found quite a few references to it in boost source code.
ANTLR - this is general parser. Do any common compilers use it?
Regarding compilers:
with front-end/back-end does gcc compiler suite uses? does it have common heritage with any other compiler?
what front-end/back-end PGI and PathScale compilers use?
what front-end/back-end XL compiler uses (IBM offering).
in-depth links on the Internet or your personal know-how would be great.
I did some Google searching, but information I generally encountered was rather superficial.
Thanks.
EDG is a front-end used by Intel and Comeau. See EDG's list of customers for other users.
ANTLR is a parser generator. I'm not aware of any C++ compiler built around a parser that was built with ANTLR (that doesn't mean it couldn't exist though).
GCC is a suite of compilers, with front ends for C, C++, Fortran, Ada, Java, etc., and back-ends for more processors than I'd care to think about.
Open64 is also a suite of compilers including several front-ends (for C, C++, Fortran, and possibly others I don't remember at the moment) and back-ends (targeting X64, Itanium, ARM, and, again, probably others I don't remember and/or don't know about). I believe its origin (pun noted by not intended) is SGI's compiler(s). I seem to remember reading something hinting that Open64 was derived from some version of the GCC front end(s), but offhand I don't know 1) how similar it remains to GCC internally, or 2) the version of GCC from which it derived -- but it's been around long enough that I'd guess it was GCC 3.x at the most recent, and quite possibly GCC 2.x.
I believe PathScale has created at least one compiler derived from Open64, but they may have others as well.
As far as I know, IBM's compiler is entirely their own creation. I'd guess IBM's (now discontinued) VisualAge for C++ shared some heritage/development/code with XL C++, but don't know that for sure, and can't even begin to guess at the extent of it, even assuming it's true.
The Clang project provides new front-ends for C/C++/Objective C on top of the LLVM backend. The LLVM project also provide a LLVM-gcc, using the GCC front end and the LLVM backend. The DragonEgg project seeks to replace the GCC backend with LLVM.
The Codeplay VectorC, Sieve and Offload compilers use a custom front-end and back-end
with front-end/backend does gcc compiler suite uses? does it have common heritage with any other compiler?
The acronym “GCC” stands for “GNU compiler collection” (originally “GNU C compiler”) and this already gives a hint: GNU compilers are a collection of compilers, most notably for C and C++ but also for Fortran, Objective-C and others. They share a common back-end and intermediate representation that was developed for GCC specifically.
The front-ends are all custom-written for the GCC. Some were contributed by third parties, most notably the Objective-C front-end, which was contributed by Apple.
Visual studio uses EDG for its intellisense engine.

C++ frontend only compiler (convert C++ to C)

I'm currently managing some C++ code that runs on multiple platforms from a single source tree (Win32, Linux, Verifone CC terminals, MBED and even the Nintendo GBA/DS). However I need to build an app targetted at an embedded platform for which there is no C++ compiler (C only). I remmber that many of the early C++ compilers were only front-ends stitting on existing C compilers (Glockenspiel for example used MSC). Are there any such 'frontend' C++ compilers in use today that will generate C code.
Tools Platform
----------- ------------
______Visual C++ _____ WIN32
/
/_______MBED (ARM)_______MBED (ARM dev board).
/
/_________GCC (x86)________Linux
/
Source____/___________GCC (ARM)________GBA/DS
\
\__________SDA______________Verifone Verix CC Terminals
\
\________ARM SDT__________Verifine VerixV CC terminals
\
\______????_____________Renases M8/16/32.
\
\____????_____________Z8 family.
The last two platforms I have good C compilers for but no C++.
As you can see I'm supporting a large variety of platforms and I share a large body of library code (and some app code).
If you use LLVM, llvm-g++ will compile your C++ code to LLVM bitcode, and llc has a backend which converts bitcode to C.
You could write commands like this:
llvm-g++ -emit-llvm -c foo.cpp -o foo.o
llc -march=c <foo.o >foo.c
Comeau C++ does this.
Can't help with the Z8, but the Renesas M16C/M32C family has GCC these days - see http://www.kpitgnutools.com/ for prebuilt cross toolchain hosted on Windows. Haven't used it myself yet but may be a better option than a 3rd party C++ frontend, especially as your code already targets GCC on other platforms.
Comeau C++ generates C as its output, and they seem to be quite happy to port it to work with different back-end compilers, though I'm not sure about the exact pricing for that.
If you want a bit more of a "roll your own" approach, you could buy a license to the EDG C++ compiler. It's normally used as a front-end (e.g. by Comeau and Intel) but I believe as it's shipped, it includes a code generator that produces C as its output. Its licensing is oriented more toward compiler vendors, though, so a license gives you a lot of rights, but is pretty expensive.
Out of date, but maybe you want to try cfront?
I'll leave this for information - cfront doesn't have exception support.
Of what I have understood, the c++ support in gcc for r8c/m16c/r32c isn't quite mature and good enough for production code. But for r8c/m16c/m32c/r32c there is at least one compiler supporting embedded C++ and that is IAR, I think Tasking also supports embedded C++ on m16c.
Notice that the valid solution is for llvm 1.3
llvm last release was 6.0.0 so it would'nt work at all.
(I post this because i've try the solution of this post but it doesn't work anymore) (Maybe i've done something bad)
In my tests llc do not accept anymore the -march=c option.
And going back to the 1.3 isn't possible for me yet.
So try to take care about the version.