tags:

views:

41

answers:

1

Setup: I installed Cygwin with the GNU programming lineup (gcc, g++, make, and gdb) and successfully compiled an ran a program that I was working on. Then I decided to install boost into Cygwin because I will need to use typical boost stuff as my program develops. So, using the Cywing setup.exe, I installed boost. After this, the program that I had just successfully compiled and ran no longer worked. (And recall that it didn't depend upon boost.)

I found out that when boost installed, it also installed a new compiler, g++-4.exe, whereas previously I had been using r++-3.exe. Boost had also symbolically linked g++.exe to the new compiler. After I changed back the symbolic link my old program compiled correctly.

Is there any reason that I should be using g++-4 rather than g++-3?

+1  A: 

g++ 3 is very old and the gcc community has long since dropped maintenance of it. (GCC 4.3 is currently the oldest maintained release series.) There have been lots of language conformance improvements in newer versions (both in accepting valid code and rejecting bad code), so you'll have an easier time going forward if you bite the bullet now. You can check the release notes for each series (e.g. for 4.0) for explanations of these improvements and the code changes they might require. Personally, I find programming much more enjoyable when I can reason about programs according to a precise language specification, and only rarely be forced to understand the quirks of a particular compiler.

Also, Boost support for g++ 3 seems to be nearing an end, as Boost 1.44 considers GCC 3(.4.6) as an "additional test compiler" on only a single platform (RHEL). Boost development is linear (not branched), so you can find yourself in a situation where you need to upgrade to get bug fixes, but then find that your platform is no longer supported.

Trevor Robinson
Wow... that's good info.
John Berryman
@Trevor - Just so you know, based upon your comments I changed the symbolic links back to g++-4 and took the extra effort to get the code working with the new compiler. In the process I started to see some of the potential issues that you were alluding to. I'm glad that I took a little time to make things right.
John Berryman
Glad to hear that it paid off so quickly. I'm currently doing C++ development with both MSVC and GCC 4.4. GCC catches a lot of invalid C++ that MSVC permits. It can be a little frustrating to have to fix "working" code, but it catches problems earlier when they're cheaper to fix. Now I can be much more confident that porting to a different OS, trying out a new compiler, or even just instantiating a template for the first time will involve a lot less hassle down the road.
Trevor Robinson