C++ Logo

std-proposals

Advanced search

Re: [std-proposals] noexcept(static)

From: Rainer Deyke <rainerd_at_[hidden]>
Date: Tue, 3 Nov 2026 18:21:32 +0100
On 11/3/26 12:19, Jonathan Grant via Std-Proposals wrote:
> Consider an image decoder where the supplied buffer is not large enough, causes the precondition to fail. The decoder may need to shut down, allowing the application to continue running and display a [no image] placeholder in the aircraft's UI.

Two possibilities:

1. The correct buffer size is known before the image decoder is called.
Passing too small of a buffer is a bug. One that is hopefully caught in
testing. For actual production usage, the program should be compiled
with a non-terminating contract evaluation semantic and NDEBUG to
hopefully prevent the program from terminating.

2. The correct buffer size is not known before the image decoder is
called, because it depends on the size of the image. Passing too small
of a buffer is neither a bug nor a precondition violation but an
expected error condition that the image decoder must report back to the
caller, where it must be handled.


-- 
Rainer Deyke - rainerd_at_[hidden]

Received on 2026-11-03 17:21:40