isocpp / isocpp/CppCoreGuidelines

ES.104: Don't underflow is actually ES.103 Don't overflow in the sense of the language

Open
#1,072 9 comments 2 reactions 1 assignee View on GitHub

@PeterSommerlad is already working on this.

Since Nov 27, 2017.

Dominant language
CSS
Stars
45.3k
Forks
5.6k
PR merge metrics
No merged PRs in 30d

Description

ES.104: Don't underflow

Reason

Decrementing a value beyond a minimum value can lead to memory corruption and undefined behavior

According to the language rules, what is described here is actually "overflow".

"underflow" has another distinct meaning.

Suggestion by ISO SC22 WG23 and WG21 SG12:

  • Merge the example of ES.104 into ES.103
  • Drop rule ES.104

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.