Skip to content

Replace erroneous use of overflow - #2341

Open
johnmcfarlane wants to merge 1 commit into
isocpp:masterfrom
johnmcfarlane:patch-2
Open

johnmcfarlane wants to merge 1 commit into
isocpp:masterfrom
johnmcfarlane:patch-2

Conversation

@johnmcfarlane

Copy link
Copy Markdown
Contributor

Modulo behaviour of unsigned integers appears to be referred to as overflow. However, unsigned integers don't overflow. Replaced "overflow behavior" with "modulo behavior".

Modulo behaviour of unsigned integers appears to be referred to as overflow. However, [unsigned integers don't overflow](https://eel.is/c++draft/basic.fundamental#note-1). Replaced "overflow behavior" with "modulo behavior".
Comment thread CppCoreGuidelines.md

Use unsigned types if you really want modular arithmetic - add
comments as necessary noting the reliance on overflow behavior, as such code
comments as necessary noting the reliance on modulo behavior, as such code

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is of course correct, but I wonder if it would be more friendly to casual readers like so:

Suggested change
comments as necessary noting the reliance on modulo behavior, as such code
comments as necessary noting the reliance on modulo behavior, i.e. wrapping to zero, as such code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants