`abi' namespace

Matt Austern austern at isolde.engr.sgi.com
Thu Feb 17 01:04:53 UTC 2000


On Feb 16,  8:08pm, Martin von Loewis wrote:

> For example, if the user writes
>
> #include <cstdio>
> namespace abi {
>   extern "C" void longjmp_unwind (jmp_buf env, int val){
>    std::printf("Hello, world\n");
>   }
> }
>
> using namespace abi;
>
> int main()
> {
>   jmp_buf foo;
>   longjmp_unwind(foo,0);
> }
>
> then he's got a well-formed C++ program, with a well-defined
> meaning. Under our ABI, all kinds of things could happen - for
> example, the code might be rejected because of a duplicate symbol.

I see your point.  OK, how about this as a compromise: use C++'s
namespace aliasing feature.  Our <cxxabi> header would look something
like this:

  namespace __cxx_abi_version1 {

    void longjmp_unwind(jmp_buf, int);
    ...

  }

  namespace abi = __cxx_abi_version1;

So the mangled name of longjmp_unwind would use the long name
 __cxx_abi_version1, which could not appear in any well formed
user program.  Anyone who includes the <cxxabi> header, however,
could use the short alias "abi".

			--Matt




More information about the cxx-abi-dev mailing list