Go to the first, previous, next, last section, table of contents.

# The Next Generation(s) of g++

- new-in-2.8.x: What's new in gcc 2.8.x?
- egcs-intro: What is egcs?
- egcs-whats-new: What's new in egcs vs 2.7.2?
- egcs-bug-fixes: What was fixed in the latest egcs releases?
- egcs-linux: If I install on Linux, will it overwrite my libraries?
- egcs-run-both: How can I run both egcs and an FSF release?
- egcs-vs-2.8.x: How will egcs affect 2.8.x?
- egcs-robustness: How robust is egcs?

## What's new in gcc/g++ 2.8.x?

After a two-year wait, gcc 2.8.0 was released in January 1998, along with libstdc++-2.8.0 and libg++-2.8.0. This has been followed up in March by the 2.8.1 release of all three packages, though libg++-2.8.1 is an "add-on" (it does not contain libstdc++ anymore). Note that libstdc++ is required.

For those familiar with egcs, the most obvious difference between gcc-2.8.x and egcs is the packaging: egcs is bundled with libstdc++, and gcc-2.8.x does not contain the class library. Otherwise, except for the lack of the `-frepo` option and some bug fixes that have not yet made it into gcc-2.8.x, C++ users will find the two compilers to be almost the same at this stage, other than that 2.8.x users may get more bogus warnings with -Wall and optimization because some fixes to flow analysis in the presence of exceptions that egcs made are not yet present in gcc 2.8.x (as of 2.8.1).

The flow analysis problem in 2.8.1 produces bad code in some cases, not just spurious errors. It only affects code that actually throws an exception, and only the path corresponding to a thrown exception gets misoptimized. If this happens, you can try reducing the level of optimization.

Because the new feature lists for egcs and gcc 2.8 are almost the same, please see See section What new C++ features are in egcs? for a list of new features. It is a fairly long list.

## What is egcs?

egcs is the experimental GNU compiler system (see ``http://www.cygnus.com/egcs'` on the Web). It is an effort to accelerate development of new gcc features by providing a more open development model than gcc has traditionally used.

The first egcs release, egcs-1.0, came out on December 3, 1997. The current release is egcs-1.0.3, released May 15, 1998.

Questions not addressed here may be answered in the egcs FAQ (``http://www.cygnus.com/egcs/faq.html'`).

## What new C++ features are in egcs?

Note: unless indicated otherwise, these features are also present in g++ 2.8.x.

- The standard C++ classes are integrated with the egcs release (but not for gcc-2.8.x, which does not include the class libraries). libg++ is not being supported, though an add-on version that will work with egcs can be found at ``ftp://ftp.yggdrasil.com/private/hjl/libg++-2.8.0b6.6.tar.gz'`, thanks to H.J. Lu. The compiler and library are configured and built in one step.
- A completely new template implementation, much closer to the draft standard. Limitations in 2.7.2.x concerning inlining template functions are eliminated. Static template data members, template class member functions, partial specification, and default template arguments are supported. An instantiation method resembling that used in Borland C++ (instantiating functions possibly in multiple .o files and using weak symbols to link correctly) is provided, in addition to other options. The SGI version of STL is shipped verbatim with libstdc++ (libstdc++ is included with egcs, separate with gcc-2.8.x).
- On ELF platforms (Linux/ELF, Solaris, SVR4), if the GNU linker is used, duplicated template functions and virtual function tables are eliminated at link time.
- The `-frepo` flag is supported in egcs (it is not in 2.8.x). However, because of the previous item, I don't recommend its use on ELF systems, as the default method is better.
- Exception handling has been re-worked; exceptions will work together with optimization. Actually, there are two separate implementations: one based on setjmp/longjmp and designed to be highly portable, and one designed to be more efficient but requiring more processor-specific support (getting exceptions right has proven to be extremely difficult and has been the chief obstacle to getting a new release out).
- RTTI has been re-done to work correctly and is on by default.
- Overloading has been re-worked to conform to the latest draft of the standard.
- There are many more changes: see ``http://www.cygnus.com/egcs/c++features.html'` for a list.

Features that are still missing include namespaces and templates as template arguments, though there is support for the latter feature in the egcs snapshots (which has not yet made it into a release).

## What was fixed in the latest egcs releases?

- Add support for Red Hat 5.0 Linux and better support for Linux systems using glibc2. (1.0.3 was specifically done to fix some remaining problems detected when building Red Hat 5.1).
- Compatibility with both egcs-1.0 and gcc-2.8 libgcc exception handling interfaces (see below).
- Various bugfixes in the x86, hppa, mips, and rs6000/ppc backends.
- A few machine independent bugfixes, mostly to fix code generation bugs when building Linux kernels or glibc.
- Fix a few critical exception handling and template bugs in the C++ compiler.
- Fix build problems on x86-solaris systems.

To avoid future compatibility problems, we strongly urge anyone who is planning on distributing shared libraries that contain C++ code to upgrade to at least egcs-1.0.1 first (and preferably to 1.0.3). See ``http://www.cygnus.com/egcs/egcs-1.0.1.html'` for details about the compatibility issues as well as additional information about the bugfixes since the egcs-1.0 release.

## If I install egcs on Linux, will it overwrite my libraries?

No. If you build from sources, by default, egcs installs executables in `/usr/local/bin` and libraries in `/usr/local/lib`, and you can change this default if desired (see next section).

If, however, you install a package (e.g. Debian or Red Hat) that wants to put egcs in `/usr/bin` and `/usr/lib`, then yes, you are replacing your system compiler and C++ library (I don't know if anyone has provided such packages yet -- proceed with caution).

## How can I run both egcs and an FSF release of g++ on the same machine?

The recommended approach is to provide a different argument to the `--prefix` flag when you configure egcs. For example, say `--prefix=/usr/local/egcs` and then, after installation, you can make symbolic links from ``/usr/local/egcs/bin'` to whereever you want, for example

    ln -s /usr/local/egcs/bin/gcc /usr/local/bin/egcc
    ln -s /usr/local/egcs/bin/g++ /usr/local/bin/eg++

## What about 2.8.x? How does egcs affect the 2.8.x development?

2.8.0 has now been released (followed up by 2.8.1), with essentially the same C++ front end as egcs.

Bug fixes generated in egcs will be passed to the 2.8.x releases for inclusion; the reverse is also taking place, though a bug fix may appear in one before it does in the other. egcs development is currently proceeding much more quickly than gcc 2.8.x development. However, there is essentially only one C++ front end, which is shared by the two distinct compiler back ends (however, since egcs-1.0.3 is newer than gcc 2.8.1, it has more bug fixes).

## How robust is egcs?

While the 'e' stands for 'experimental', egcs has been tested thoroughly and should be of high quality. The author considers egcs 1.0.3 the most robust GNU C++ compiler ever produced.

Go to the first, previous, next, last section, table of contents.