Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2019-10-25 14:42:23

On 10/25/19 3:16 AM, Hans Dembinski via Boost wrote:
>> On 24. Oct 2019, at 18:47, Robert Ramey via Boost <boost_at_[hidden]> wrote:
>> I want to detect whether or not the -no_exception compile time flag has been used on gcc/clang. Will BOOST_NO_EXCEPTIONS do this? If not is there something I can use?
> Yes, it does.

Hmmm - I've written a small test which seems to show that it doesn't.

#include <boost/config.hpp>
#include <exception>

int main(int, char *[]){
        #ifdef BOOST_NO_EXCEPTIONS
        throw std::exception();

I'm still investigating this.

>I would not set this compiler flag by hand, you can use b2 exception-handling=off.

Hmmm - I would not think it's a good idea to make a library component
dependent on the user using b2 to build it.

> If you use the BOOST_THROW_EXCEPTION macro, you normally do not need to use BOOST_NO_EXCEPTIONS directly. I use BOOST_NO_EXCEPTIONS in some unit tests of throws to avoid warnings about unused variables. Often it is not needed there as well. BOOST_TEST_THROW from boost/core/lightweight_test.hpp automatically expands to a nothing when BOOST_NO_EXCEPTIONS is set, for example.
> _______________________________________________
> Unsubscribe & other changes:

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