identification versus demangle

Hi all, I want to print and visualize MPL.Graph (and thus MSM) metadata. I'm debating whether to help "Make boost::units::detail::demangle an official utility function" [1] (actually the public function is peacefully called simplify_typename) or to use Joel Falcou's Identification library [2]. It would be annoying to users to have to register every type in their graph/state machine, so I guess I'm wondering if demangle(typeid(T).typename()) is impossible on a lot of compilers. Anyone know this? Thanks, Gordon [1] https://svn.boost.org/trac/boost/ticket/4876 [2] https://github.com/boost-vault/Miscellaneous/blob/master/identification-v0.3...

On 07/10/2011 08:17 PM, Gordon Woodhull wrote:
Hi all,
I want to print and visualize MPL.Graph (and thus MSM) metadata.
I'm debating whether to help "Make boost::units::detail::demangle an official utility function" [1] (actually the public function is peacefully called simplify_typename) or to use Joel Falcou's Identification library [2].
It would be annoying to users to have to register every type in their graph/state machine, so I guess I'm wondering if demangle(typeid(T).typename()) is impossible on a lot of compilers.
Anyone know this?
Why not print things at compile time through a warning?

On Jul 10, 2011, at 3:08 PM, Mathias Gaunard wrote:
On 07/10/2011 08:17 PM, Gordon Woodhull wrote:
It would be annoying to users to have to register every type in their graph/state machine, so I guess I'm wondering if demangle(typeid(T).typename()) is impossible on a lot of compilers.
Why not print things at compile time through a warning?
Interesting. I could wrap the types in something easy to find and then not worry about compiler differences. Related question, then: why has mpl::print<> never worked for me on gcc? template<typename E> void operator()(found_edge<E>) { typename mpl::print<E>::type foo; // nothing happens Is there an alternative? I just end up hacking my own errors when I have to debug stuff, but that won't work here. Thanks, Gordon

On 07/11/2011 01:02 AM, Gordon Woodhull wrote:
On Jul 10, 2011, at 3:08 PM, Mathias Gaunard wrote:
On 07/10/2011 08:17 PM, Gordon Woodhull wrote:
It would be annoying to users to have to register every type in their graph/state machine, so I guess I'm wondering if demangle(typeid(T).typename()) is impossible on a lot of compilers.
Why not print things at compile time through a warning?
Interesting. I could wrap the types in something easy to find and then not worry about compiler differences.
Related question, then: why has mpl::print<> never worked for me on gcc?
template<typename E> void operator()(found_edge<E>) { typename mpl::print<E>::type foo; // nothing happens
Is there an alternative? I just end up hacking my own errors when I have to debug stuff, but that won't work here.
That could be a defect of mpl::print. I believe the following implementation works reliably well with GCC. template<class T> struct print { typedef T type; unsigned : 80; };

On Tue, Jul 12, 2011 at 11:34:39AM +0200, Mathias Gaunard wrote:
On 07/11/2011 01:02 AM, Gordon Woodhull wrote:
Is there an alternative? I just end up hacking my own errors when I have to debug stuff, but that won't work here.
That could be a defect of mpl::print.
I believe the following implementation works reliably well with GCC.
template<class T> struct print { typedef T type; unsigned : 80; };
If anyone cares for obscure facts about exotic compilers, VisualAge C++ gladly accepts oversized bitfields without any informational messages whatsoever. -- Lars Viklund | zao@acc.umu.se
participants (3)
-
Gordon Woodhull
-
Lars Viklund
-
Mathias Gaunard