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


On 10/25/19 7:42 AM, Robert Ramey via Boost wrote:
> 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();
>     #endif
> }
>
> I'm still investigating this.

Looks like I setup my test wrong. Should be

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

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

This does seem to respond to the command line switch -fno-exceptions as
I would hope. So I guess my question is answered.

Thanks to everyone for their constructive comments and suggestions.

Robert Ramey