C++ Logo

std-proposals

Advanced search

Re: [std-proposals] noexcept(static)

From: Jonathan Grant <jgrantonline_at_[hidden]>
Date: Tue, 3 Nov 2026 21:37:37 +0000
On 03/11/2026 17:32, Sebastian Wittmeier via Std-Proposals wrote:
> 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.
>

Maybe C++ Contracts should not be used for this constraint violation (image decodes to larger size than a fixed sized buffer)? Otherwise pre() or contract_assert() would call the contract-violation-handler. Which then may call std::terminate() and isn't allowed to throw an exception.

>
>
> 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.)
>
Good points too. Maybe would need to test with a mock sensor, in a simulator build. Ariane 5 suffered 16-bit overflow bug. Or Mariner 1 typo bug.

Regards
Jonathan

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