Optionally disable Fungo dependency

Issue #4 resolved
Jamin Grey
created an issue

I'm using C++11, so I don't require Fungo's nice benefits. In using 'dbg' I removed the dependency on Fungo:

raise.hpp (line 36), the following change was made:

/* ::fungo::raise(exception); Disabled Fungo dependency. */
throw exception;

raise.hpp (line 96), the changes:

/* ::fungo::raise( ::dbg::impl::tagged<Exception>(ex) ); */
throw ::dbg::impl::tagged<Exception>(ex);

throw.hpp (line 16 and 17) : Two Fungo-related comments removed.

It'd be great if dbg checked for whether C++11 is enabled, and compiles out Fungo. Or, in lack of conforming ways to test for C++11, perhaps a #define conditional: DBG_USE_FUNGO

When the define is absent, could it revert to regular C++ throws?

Comments (3)

  1. Edd Dawson repo owner


    This sounds like an entirely reasonable suggestion!

    I think I'd probably have a DBG_DONT_USE_FUNGO instead, as it's safe to use fungo even in C++11. The std::exception_ptr machinery should be oblivious. Accidentally not using fungo could lead to mistakes for us chumps still on C++03.

    I'm a little worried about One Definition Rule violations occurring, as every compilation unit that uses the DBG_RAISE macro will have to define (or not) the DBG_(DONT_)USE_FUNGO macro consistently in order to see the same definition for dbg::impl::raise<>().

    Not an insurmountable problem, but will need a little thought. Suggestions welcome!

    In the case of C++11, I believe it could indeed revert to a regular throw statement, unless "exception logging" is still needed. In this case, ::dbg::impl::tagged<> wrapper would still need to be applied, as that helps with recording the point at which an exception is thrown (for tracebacks in termination handlers etc). But this shouldn't interfere with C++11 machinery either.

    Thanks for the suggestion. If it takes me longer than you'd like to get around to this, please feel free to bump the thread. It may take a week or two, though as I have a lot on at the moment.

  2. Log in to comment