Boost logo

Boost :

Subject: Re: [boost] [config] Proposed BOOST_NOEXCEPT_NOTHROW macro
From: Beman Dawes (bdawes_at_[hidden])
Date: 2012-09-03 14:11:04


On Mon, Sep 3, 2012 at 12:37 PM, Stewart, Robert <Robert.Stewart_at_[hidden]> wrote:
> Jeffrey Lee Hellrung wrote:
>> On Sun, Sep 2, 2012 at 9:19 AM, Dave Abrahams
>> <dave_at_[hidden]> wrote:
>> > on Wed Aug 29 2012, Roland Bock <rbock-AT-eudoxos.de>
>> > wrote:
>> > > On 2012-08-29 15:31, Beman Dawes wrote:
>> > >>
>> > >> My thinking was that there was some small advantage to
>> > >> beginning each of the noexcept macros with BOOST_NOEXCEPT.
>> > >>
>> > >> I worry that BOOST_THROWS_NOTHING would be misconstrued
>> > >> as a replacement for "Throws: Nothing" specifications, and
>> > >> that isn't the case. BOOST_NEVER_THROWS might be a bit
>> > >> better. But I think I still prefer
>> > >> BOOST_NOEXCEPT_OR_NOTHROW. Or the original suggested
>> > >> BOOST_NOEXCEPT_NOTHROW.
>> > >
>> > > BOOST_NOEXCEPT_AND_NOTHROW ? OR sounds like a choice.
>> >
>> > Should just be BOOST_NOEXCEPT, IMO.
>> > Design for the future.
>>
>> We already have a BOOST_NOEXCEPT that expands to nothing in
>> C++03, right? I understood the point of this proposed macro was
>> to support those decorators on virtual functions that were
>> "throw ()" in C++03 but got changed to "noexcept(true)" in
>> C++11.
>
> There are two cases. In C++03, some functions had to be
> decorated with throw(), but most, even if they didn't throw, were
> left with no decoration because throw() is a pain for multiple
> reasons.
>
> Beman created BOOST_NOEXCEPT to handle the latter case: a
> function that throws, and hopefully is documented as throwing,
> nothing becoming noexcept in C++11. Now he needs a macro that is
> noexcept in C++11, but throw() in C++03.
>
> Given that BOOST_NOEXCEPT has already been used for the former,
> another name is needed for the latter.
>
> "BOOST_NOTHROW" is short, conveys the right idea, but isn't
> forward looking. Then again, when we can ignore C++03, s/BOOST_NOTHROW/BOOST_NOEXCEPT/ would bring all code into C++11
> without harm.

That's an interesting suggestion.

We already have BOOST_CONSTEXPR_OR_CONST, so I'm still leaning toward
BOOST_NOEXCEPT_OR_NOTHROW just for consistency. We can do a global
change to BOOST_NOEXCEPT for that name, too, when we no longer want to
support C++03 compilers.

Given that it is a 3-day holiday weekend in the US, I'll give it
another day or two. But then we need to move on to higher priority
work.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk