C++ Logo

std-proposals

Advanced search

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

From: trtaab trtaab <tvfvof_at_[hidden]>
Date: Thu, 6 Jul 2023 01:56:37 +0000
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.

The "silent_at" method, on the other hand, aims to provide a more lightweight and efficient alternative. Its primary objective is to perform bounds checking while ensuring a completely silent crash without any output. By utilizing mechanisms such as __builtin_trap() in GCC and Clang, the method offers a controlled program termination without producing any additional garbage or debug output.

This distinction is particularly important for developers who prioritize performance and optimization, as well as those who prefer a minimalistic approach without the overhead of exceptions or unwanted output.

If the committee finds merit in exploring this proposal further, I would be grateful for the opportunity to discuss potential alternatives and gather additional insights from committee members and the wider C++ community.

Thank you for your consideration, and I am open to any further questions or discussions on this topic.

Sincerely.

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows


Received on 2023-07-06 01:56:40