C++ Logo

std-proposals

Advanced search

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

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Thu, 6 Jul 2023 09:20:55 +0100
On Thu, 6 Jul 2023 at 03:03, Jason McKesson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> 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.
>
>
The comment has nothing to do with libstdc++ internals, the observation
refers to the (experimental) language feature supported by GCC:
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-fcontracts

Received on 2023-07-06 08:21:09