Boost logo

Boost :

From: Ian McCulloch (ianmcc_at_[hidden])
Date: 2004-08-25 11:06:16

Markus Schöpflin wrote:

> Hello!
> Currently, the name mangling scheme used on this platform is the default
> one selected by the compiler. It turns out that this is a bad choice when
> compiling boost. The problem is illustrated by the following example:
> ---%<---
> #include <iostream>
> using namespace std;
> template <typename T> void foo(T const &x)
> {
> cout << "1" << endl;
> }
> template <typename T> void foo(T * const &x)
> {
> cout << "2" << endl;
> }
> int main()
> {
> foo("abc");
> return 0;
> }
> --->%---
> This prints out "2" with the default name mangling scheme. When manually
> selecting "ansi" as the name mangling scheme, the correct result "1" is
> printed.
> Therefore I propose to explicitely set the name mangling to ansi in the
> tools file for this compiler. Does anyone have any strong feelings or
> arguments against such a change?

probably "-model ansi" is sufficient, and IMO absolutely necessary. IIRC
correctly, there are issues with class-scope enumerations colliding, and in
the past I also had a problem with non-type template parameters that I
can't remember the details of just now.

>From the cxx man page:

-model [ansi | arm]

 [Tru64] Determines the layout of C++ classes, name mangling, and exception
handling. On Tru64 UNIX, the default is -model arm; on Linux Alpha, the
default is -model ansi. The -model arm option is not supported on Linux

The -model arm option is the default and generates objects that are link
compatible with all Compaq C++ releases prior to Version 6.3, and with all
objects compiled using the -model arm option in Compaq C++ Version 6.3 or
later. Specifying this option defines the macro __MODEL_ARM.

The -model ansi option supports the complete ISO/ANSI C++ specification,
including distinct name mangling for templates. The ANSI model also reduces
the size of C++ non-POD class objects. Note that this option generates
objects that are not compatible with prior releases of Compaq C++, or with
objects compiled using the -model arm option.

If you specify the -model ansi option, you must recompile your entire
application, including libraries. Specifying this option defines the macro

Ian McCulloch

Boost list run by bdawes at, gregod at, cpdaniel at, john at