C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Efficient and silent bounds checking with silent_at()

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 5 Jul 2023 22:03:25 -0400
On Wed, Jul 5, 2023 at 9:56 PM trtaab trtaab via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Dear Jason McKesson,
>
>
>
> Thank you for your response and bringing up the topic of contracts. While the proposed "silent_at" method shares similarities with contracts in terms of enforcing bounds checking, there are some key distinctions to consider.
>
>
>
> Contracts, as currently implemented in the libstdc++ library, can be computationally expensive due to the additional overhead introduced by passing parameters to the contract violator and the use of exception throwing for the contract terminator. Furthermore, contracts may generate output, which can include additional debug information that some developers prefer to avoid.

I don't know of the current state of contracts as a C++ language
proposal, but the last time I looked into them, basically none of that
existed. So I'm don't care overly much about something libstdc++ has
done internally; if the actual language feature doesn't require any of
that overhead, then bringing it up here is essentially a non-sequitur.

Received on 2023-07-06 02:03:39