C++ Logo

std-discussion

Advanced search

Re: What is the difference between "Throws: Nothing." and noexcept(true)

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Wed, 15 Jul 2020 12:26:28 +0200
Il 15/07/20 11:18, Peter Sommerlad (C++) via Std-Discussion ha scritto:
> while looking at <charconv> I was wondering why the from_chars() and
> to_chars() are not noexcept. I understand that noexcept might lead to
> worse code generation because of std::terminate() might need to be called.
>
> Is that the sole reason for not making those functions noexcept(true) ?

They have preconditions, e.g. [first,last) is a valid range, base is
between 2 and 36, and so on -- wouldn't that suffice to say that they
can't be noexcept?

My 2 c,
-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Received on 2020-07-15 05:29:51