C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] C++ res.on.exception.handling and POSIX function signatures

From: Richard Smith <richardsmith_at_[hidden]>
Date: Mon, 9 Nov 2020 00:33:47 -0800
On Mon, Nov 9, 2020 at 12:09 AM Florian Weimer via Liaison <
liaison_at_[hidden]> wrote:

> * Hubert Tong via Liaison:
>
> > It appears C++20 subclause 16.4.6.13 [res.on.exception.handling]
> > allows C standard library functions that are present in the C++
> > standard library to be declared as being `noexcept(true)`; however,
> > the same cannot be said of POSIX or LSB system interfaces.
>
> Would you please elaborate your concern? Are you worried about missed
> optimizations? Why does POSIX make a difference here?
>
> The current C++ draft says this in the subclause you referenced:
>
> | An implementation may strengthen the exception specification for a
> | non-virtual function by adding a non-throwing exception specification.
>
> Isn't this a mistake because it alters the types of those functions
> since C++17?
>

It certainly alters the types, but that's not necessarily a problem;
there's a conversion from "pointer to noexcept function ..." to "pointer to
function ...". The exact type of such a function is just another item in
the long list of properties of the C++ standard library that a portable
program can't rely on.


> The part about C standard library functions should probably removed
> because it's just an optimization (and an optimization that is incorrect
> for many C implementations).
>
> Thanks,
> Florian
> --
> Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
> Commercial register: Amtsgericht Muenchen, HRB 153243,
> Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael
> O'Neill
>
> _______________________________________________
> Liaison mailing list
> Liaison_at_[hidden]
> Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/liaison
> Link to this post: http://lists.isocpp.org/liaison/2020/11/0232.php
>

Received on 2020-11-09 02:34:01