Date: Tue, 3 Nov 2026 18:32:54 +0100
I think that is not enough:
1b) The correct image size was the responsibility of the caller. The decoder still checked the precondition and found an error.
2b) The correct image size is not known beforehand, but the overall system development group/team should have made sure that only working images are loaded. So it is neither the responsibility of the caller, nor the callee, but of the organisation.
(In other similar examples, there can be assumptions that the airplane never reaches Mach 2, that a sensor never returns negative values, etc.; or some combination of factors. Sometimes it is overlooked to additionally check them in software with a clear responsibility of the software module. Still the compile mode may create mandatory pre-condition checks as added safety layer.)
-----Ursprüngliche Nachricht-----
Von:Rainer Deyke via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Di 03.11.2026 18:21
Betreff:Re: [std-proposals] noexcept(static)
An:std-proposals_at_[hidden];
CC:Rainer Deyke <rainerd_at_[hidden]>;
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]
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2026-11-03 17:34:06
