On 01 April 2007 07:08, ganesh subramonian wrote: > Hi > I work in a company where we have been using gcc-2.95.4 (based cross > compiler) for compiling our code. Most of the code is written in c++ > and makes extensive use of the stl libraries. We would not be changing > our operating system or processor architecture (so portability is not > a very good reason to give). There seems to be a lot of changes since > gcc-2.95 as a result of which we get a large number of errors when > trying to compile the code with gcc-3.x.
Yes, this is known. The C++ language standard was still changing in the 2.95->3.x timescale, and GCC moved a lot closer to strict conformance. See http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus You may find that using a 3.3 series compiler requires a good deal less rewriting than a 3.4 series compiler; which version did you try? > If we were to put in quite some effort to get the entire code-base > compiling in gcc-3.x, what advantages would we get as a result of this > (in terms of code-size reduction or faster execution of compiled > binaries). Are there any new glibc,libstdc++ (or other libraries) > features which are there in 3.x/4.x which are unavailable in 2.95? > If you were asked to convince someone about moving from gcc-2.95 to > gcc-3.x how would you people do it? Well, one of the advantages would be that you'd end up fixing all the non-standardisms in your code base, which will be of long term benefit to the maintainability and portability of your codebase, but hard to express in figures. As time goes by, new employees in your firm are going to know standard C++ and find some of your old code confusing; mistakes could arise if you keep all your old code without ever brushing it up a bit. New features: the STL implementation in 3.3 is far more complete, correct and efficient than whatever 2.95 had. I don't know much else off the top of my head, I'm not a C++ expert. For other changes and improvements, you should browse the release announcement/changelist pages (such as the one linked above)at the gcc website, they'll be much more comprehensive than anything I can say here. As to code size reduction and better code generation overall: yes, you can expect to gain from moving up to gcc-3. It has more and better optimisations, it has old bugs fixed compared to 2.95. Of course, there are also conceivably new bugs; no change is entirely without risk. The problem is, there's no hard numbers we can offer you; the effect of adding better optimisations very much depends on the form and structure of your codebase and how much opportunity there is for such optimisations to be made. The only real thing that would make your case watertight would be for you to actually do some porting work, and build at least part of your codebase with a new version of the compiler, and run profiling and tests on the generated code: get actual hard measurements of code size and runtimes. It's even conceivable you might find the old compiler generating better output for your particular code. That might shift the balance of your cost-benefit argument back toward hanging on with your old compiler, perhaps until there was more resource available to put some time into refactoring your code to play better with a newer compiler version. It's a hard call, there are always a lot of uncertainties in changing some piece of your infrastructure, which is why people's instinct is often to not fix what they can't see is visibly broke; that's why real hard numbers are most valuable in trying to call it. cheers, DaveK -- Can't think of a witty .sigline today....