I have read some questions about GCC vs MSVC and the development of these compilers such as GCC worth using on Windows to replace MSVC?, Visual Studio or GCC? and GCC vs MS C++ compiler for maintaining API backwards binary compatibility. But those are very outdated questions(2011). With new c++14 features coming things are starting to balance between the two compilers. Is it still worth using Code::Blocks on Windows with all the advantages of using Microsoft Visual Studio such as:
In most of the topics I have read, they always say GCC code generation was better than MSVC's, but the differences in that matter were starting to narrow. Is code generation still better in GCC? What about newest c++ features, which of them is ahead?
The biggest advantage I see in using GCC versus MSVC is that:
C++14 features on GCC: https://gcc.gnu.org/projects/cxx1y.html
C++11 and C++14 features on MSVC RTM: http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx
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.
MSVC is doing the compilation job significantly faster than MinGW-w64. The DLL sizes are comparable, if optimization is set to "-O2" for MinGW-w64, with "-O3" the DLLs from MinGW-w64 are larger. Binary files compiled with MinGW-w64 are performing significantly better than those compiled with MSVC.
When I switched to both clang and MSVC 64-bit versions, I see MSVC is faster than clang by about 1.5X. On 32-bit toolsets, I saw that MSVC is 2X slower than Clang. This, however, is totally believable because MSVC performance is tracked mostly on the 64-bit toolset.
Though there are many compilers available for C, GCC stands out to be one of the best as of now. The winner declaration here lies based on durability, optimization, speed, and code/error/syntax checks.
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. 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.
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.
That includes the topic of this blog post: the Microsoft Visual C++ compiler and libraries toolset (MSVC). Our goal for MSVC is to be the best compiler choice on Windows for targeting Windows, regardless of what editor or IDE you choose to use.
The best compiler for code running on Windows is msvc, hands-down. There is no debate about it, and it was not included in your question. I have no experience with LLVM, but I have experience with consumer products for the past decade shipped over multiple Windows OS releases. And GCC just does not work flawlessly. Neither. Choose Visual C++.
The elaborated question is an open invitation to opinions; there's even some provocation about "best IDE" etc. Even so the question as posed in the title,
” C++ - Is GCC [i.e. g++] worth using on Windows nowadays?
has a simple fact-based answer, namely yes, because
it's a good idea to expose code to at least two compilers, when that's possible, e.g. the combo Visual C++ and g++, and
g++ is good for purposes of learning.
The main problem with g++ in Windows is that its API binding only covers the Windows XP API fully, and nothing very little after.
Yes.
Although MSVC has made some progress toward newer C++ standards, it is still woefully behind, even on C++98 status (which is conveniently excluded from that status page).
From what I've read recently, the MSVC team does not even have a concrete plan for fixing some of the old issues, e.g. with name lookup and template instantiation.
Now, when you can use MSVC with clang as the compiler, that might be reason to stop using GCC. However, for my purposes, I find that clang has much inferior diagnostics (and sometimes inferior code) so I still use GCC as my primary compiler and just use clang as a backup.
And as @Cheersandhth says, it's good to use two compilers. Though maybe look at Intel's compiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With