C++ Logo


Advanced search

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

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Mon, 9 Nov 2020 08:01:10 +0000
On Mon, 9 Nov 2020, 01:21 Hubert Tong via Lib, <lib_at_[hidden]> wrote:

> It appears C++20 subclause [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.

To make sure I understand, you're talking about POSIX functions such as
read(3) which are not in ISO C, right?

Some guidance would be useful.

No standard says what it means to include a POSIX header in a C++ program
at all. While it would probably be useful to say that it's unspecified
whether POSIX APIs are noexcept(true) or noexcept(false) when used in C++,
I don't know where that wording could live. Adding it to POSIX would open a
can of worms, because it's not very useful to say that without saying a lot
more. Adding it to the C++ standard seems wrong, because WG21 doesn't own
those APIs.

I assume the same applies to LSB but I'm much less familiar with that

The attempt to specify a C++ binding for POSIX never got anywhere. Maybe we
should consider publishing an informational TR describing what happens in
real work implementations, without trying to standardise anything.

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