LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   What version of GCC do you use? (https://www.linuxquestions.org/questions/programming-9/what-version-of-gcc-do-you-use-732869/)

fuzzyBuzz 06-14-2009 11:42 AM

What version of GCC do you use?
 
Hi all,

I am starting a new Linux project in C++, and i was wondering what GCC version to use.
I was hoping people would share their thoughts about which GCC version is best to use in terms of stability, performance, portability, compliance with language extension, etc.
Do you have a specific version you use for your work and prefer to stay with it, or do you like to use the latest available release (or even development versions)? When is it a good time to upgrade to a newer version?

TIA.

Sergei Steshenko 06-15-2009 11:31 AM

4.3.3

johnsfine 06-15-2009 12:39 PM

Quote:

Originally Posted by Sergei Steshenko (Post 3574677)
4.3.3

Any particular reason you prefer it? Or it is just what you happen to use?

Quote:

Originally Posted by fuzzyBuzz (Post 3573553)
I am starting a new Linux project in C++

32 bit x86 or x86_64? I think that might affect the choice of compiler version.

What kind of project also might affect the choice.

Do you really want to select a different version than the default for your Linux distribution? GCC makes it pretty easy to install and use a different version than the distribution default and/or have multiple versions installed and usable on one Linux system. But that isn't totally trivial, so I wouldn't do so without a reason.

Currently I use GCC heavily only for x86_64 Linux. I also use a closed source compiler from Intel heavily on all four combinations of Windows/Linux and 32/64 bit. On 32 bit GCC is much worse than the Intel compiler. On 64 bit that comparison is more complicated and no really clear winner. I expect you need an open source compiler, so even in 32 bit you're stuck with GCC.

I mainly use GCC 4.3.2 and I'm pretty happy with it. I also use GCC 4.1.2 and did a fair about of playing with GCC 4.4.0.

I do a moderate amount of profiling with Oprofile and a moderate amount of debugging. My source code has deep templating and deep inlining. The underlying tools that read the debugging info (for either profiling or debugging) get very confused. They get a LOT more confused by the GCC 4.3.2 generated debug info than the GCC 4.1.2 generated debug info, even in places where the generated asm code is the same. But I don't know if that is really a 4.3.2 vs. 4.1.2 difference or something uniquely weird about my source code or something wrong in the way I built binutils.

I also use OpenMP, which is supported by 4.3.2 and not by 4.1.2.

I'm trying to learn various optimizer hints because performance is very important in my code. I noticed some optimizer hints work in 4.4.0 that don't work in 4.3.2. I also noticed some optimizer hints supposedly present in 4.4.0 that I really want to use, but they don't actually work. I haven't had the time to follow up as much as I should on that kind of investigation. Clearly there is continuing improvement in the support of optimizer hints. That matters a lot to me and may justify moving closer to the cutting edge (or bleeding edge) version. But I don't know enough to make that decision well myself much less advise you.

noctilucent 06-15-2009 03:09 PM

I'd rather worry more about correctness, clarity, cleanliness, stability, security, portability and eventually algorithm optimization [speed] at this point [or, heck, indeed - just getting the damned thing to work in the first place] rather than optimization by means of the compiler.. or using features which depend on a certain version of a certain compiler for a certain architecture. On Linux I just use whichever compiler the distribution in question ships at that point in time [this machine: gcc 4.4.0]

johnsfine 06-15-2009 03:25 PM

Quote:

Originally Posted by johnsfine (Post 3574760)
Do you really want to select a different version than the default for your Linux distribution?

Maybe I buried that too deep in my first long post.

Quote:

Originally Posted by noctilucent (Post 3574941)
On Linux I just use whichever compiler the distribution in question ships at that point in time

For most situations that is the right answer to the question of this thread.

That is very much not my answer at home, because I'm very interested in playing with compiler behavior. At home, I'm as likely to be using the application source code to see how the compiler behaves as using the compiler to build the application.

It is also very much not my answer at work, because we have several people working on a closed source product and several Linux computers (not all the same version of Linux) and we need to have consistent (behavior and performance) output from compilers. Until we explicitly qualify a new compiler, all behavior and performance differences should be attributable to our code changes and never to which Linux server some developer chose to run the build process on. (Before I became involved in that decision process here, build details did depend heavily on which server was used for the build. That was an ongoing nightmare until I fixed it.)

But in both those cases, what is right for me is not likely right for the OP. So you need a reason to deviate from the obvious answer of "whichever compiler the distribution in question ships".

Sergei Steshenko 06-15-2009 04:39 PM

Quote:

Originally Posted by johnsfine (Post 3574760)
Any particular reason you prefer it? Or it is just what you happen to use?

...


The last I built - I routinely build 'gcc', and I have a number of versions.

Seems good enough.

I'm reluctant to build 4.4.0, but will probably build 4.4.1 - let's give the developers a chance to fix some bugs.

bigearsbilly 06-16-2009 01:01 PM

just use the one installed on your system.


All times are GMT -5. The time now is 12:00 AM.