I'm trying to detect at compile time whether exceptions have been disabled with the (-fno-exceptions
) switch. I've tried to evaluate:
noexcept(throw)
But this won't compile if the exceptions are disabled under both gcc and clang.
EDIT: Take a look here.
As always, it's fairly easy to check which macros are pre-defined for a particular compiler with a given set of command line parameters:
$ g++ -dM -E -x c++ - < /dev/null &> except.txt
$ g++ -dM -E -x c++ -fno-exceptions - < /dev/null &> no-except.txt
$ sdiff -s except.txt no-except.txt
#define __EXCEPTIONS 1 <
#define __cpp_exceptions 199711 <
$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With