[PATCH] Add noexcept to various basic_string string operations

Jonathan Wakely jwakely@redhat.com
Tue Dec 6 11:00:00 GMT 2016


On 06/12/16 10:59 +0000, Jonathan Wakely wrote:
>On 06/12/16 05:55 -0500, Tim Song wrote:
>>On Tue, Dec 6, 2016 at 5:43 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>None of these functions can throw, so we should mark them as such.
>>>I've reported this as a defect against C++17, because they should have
>>>been made noexcept after the application of https://wg21.link/p0254r2
>>
>>Surely the const _CharT* variants are narrow contract? Or was there a
>>policy change here?
>
>That's a guideline for the standard, not for implementations. In
>libstdc++ we don't use exceptions for precondition violations anyway,
>We abort() in Debug Mode for some conditions, but don't throw.
>
>It has always been our policy to strengthen the noexcept guarantee on
>functions that can't throw, there is no change.

Oh, but if you mean what the standard should say, my issue submission
proposed "Throws: Nothing." for the ones with a narrow contract. It
should be in the issue list soon, but I only sent it yesterday.



More information about the Libstdc++ mailing list