Boost logo

Boost :

Subject: Re: [boost] [Boost.DLL] Formal Review request
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2014-10-04 18:34:27

On 4 Oct 2014 at 14:42, Mathias Gaunard wrote:

> On 04/10/2014 13:24, Niall Douglas wrote:
> > Andrey, please list here three C++ compilers which had at least one
> > version release in the past five years which doesn't provide a magic
> > macro expanding out to the mangling of the enclosing function.
> What about MinGW?

I just ran the following program on MinGW:

#include <iostream>
#include <typeinfo>

template<class T> void doprint(T a)
  std::cout << __func__ << std::endl;
  std::cout << __FUNCTION__ << std::endl;
  std::cout << __PRETTY_FUNCTION__ << std::endl;
  struct $$$ { };
  std::cout << typeid($$$).name() << std::endl;
template<class T> struct doprint$$$___$$$ { };

int main(void)
  std::cout << typeid(doprint$$$___$$$<int>).name() << std::endl;
  return 0;

It prints:

void doprint(T) [with T = int]

Something I was wrong about is that there is no equivalent to
__FUNCDSIG__ in GCC - I had thought that __FUNCTION__ produced
mangled symbols, and I was wrong on that - I can find no magic macro
for GCC which can. You can however still fall back onto typeid,
albeit this forces a dependency on RTTI. I suppose one could just
parse one's own ELF binary headers to look up mangled symbols you
yourself instantiated, but that is getting a bit extreme.


ned Productions Limited Consulting

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