Skip to content

new arithmetic overflow rule#220

Merged
PLeVasseur merged 19 commits into
Safety-Critical-Rust-Consortium:mainfrom
rcseacord:feature/arithmetic-overflow
Dec 4, 2025
Merged

new arithmetic overflow rule#220
PLeVasseur merged 19 commits into
Safety-Critical-Rust-Consortium:mainfrom
rcseacord:feature/arithmetic-overflow

Conversation

@rcseacord

Copy link
Copy Markdown
Collaborator

@netlify

netlify Bot commented Nov 14, 2025

Copy link
Copy Markdown

Deploy Preview for scrc-coding-guidelines ready!

Name Link
🔨 Latest commit d35606c
🔍 Latest deploy log https://app.netlify.com/projects/scrc-coding-guidelines/deploys/6931522be7517d00080dd55f
😎 Deploy Preview https://deploy-preview-220--scrc-coding-guidelines.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@felix91gr felix91gr self-assigned this Nov 19, 2025
@felix91gr
felix91gr self-requested a review November 19, 2025 16:33
@PLeVasseur PLeVasseur added the coding guideline An issue related to a suggestion for a coding guideline label Nov 25, 2025

@felix91gr felix91gr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Preliminary review. We have a meeting together now, so I'd better submit it right away.

Comment thread src/coding-guidelines/expressions.rst Outdated
Comment thread src/coding-guidelines/expressions.rst Outdated
@rcseacord
rcseacord requested a review from felix91gr November 26, 2025 22:18
@rcseacord

Copy link
Copy Markdown
Collaborator Author

@felix91gr please approve me sir I am ready to be merged

@rcseacord

Copy link
Copy Markdown
Collaborator Author

@felix91gr please review me. i'm very sad and wished to be merged.

Comment thread src/coding-guidelines/expressions.rst Outdated
@felix91gr

Copy link
Copy Markdown
Collaborator

@rcseacord there's a merge conflict. It seems to be pretty trivial from here, and Github offers to let me resolve it in the Web UI, but I'd rather you resolve them instead because I don't want to break your working copy

rcseacord and others added 8 commits December 3, 2025 19:32
fixed a bunch of small problems and started adding compliant solutions using saturation semantics
adding Wrapping<T> example
Revised guidelines on arithmetic overflow, emphasizing prevention and the use of explicit wrapping functions. Updated examples to reflect compliant practices with saturation semantics.
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
Clarify guidelines on eliminating arithmetic overflow for various integer types.
Clarify behavior of arithmetic overflow in Rust.
@rcseacord
rcseacord force-pushed the feature/arithmetic-overflow branch from aa88512 to 81e0d9e Compare December 4, 2025 00:35
rcseacord and others added 2 commits December 3, 2025 19:36
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
@rcseacord
rcseacord requested a review from felix91gr December 4, 2025 00:39
Comment thread src/coding-guidelines/expressions.rst Outdated
@rcseacord

Copy link
Copy Markdown
Collaborator Author

@felix91gr rebased, please review!

@felix91gr felix91gr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be a reasonable first review, I hope

Comment thread src/coding-guidelines/expressions.rst Outdated
Comment thread src/coding-guidelines/expressions.rst
Comment thread src/coding-guidelines/expressions.rst
Comment thread src/coding-guidelines/expressions.rst Outdated
Comment thread src/coding-guidelines/expressions.rst
Comment thread src/coding-guidelines/expressions.rst Outdated
Comment thread src/coding-guidelines/expressions.rst Outdated
Comment thread src/coding-guidelines/expressions.rst Outdated
Comment thread src/coding-guidelines/expressions.rst Outdated
Comment thread src/coding-guidelines/expressions.rst Outdated
rcseacord and others added 2 commits December 4, 2025 04:12
Clarified behavior of arithmetic overflow in debug and release modes. Updated examples to emphasize the use of explicit wrapping and saturation semantics.
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
rcseacord and others added 6 commits December 4, 2025 04:13
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>

@PLeVasseur PLeVasseur left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks @rcseacord

@PLeVasseur
PLeVasseur added this pull request to the merge queue Dec 4, 2025
Merged via the queue into Safety-Critical-Rust-Consortium:main with commit 1b00276 Dec 4, 2025
6 checks passed
@rcseacord
rcseacord deleted the feature/arithmetic-overflow branch December 4, 2025 14:27
@AlexCeleste

Copy link
Copy Markdown
Collaborator

Reviewed in session 2025-12-03

manhatsu pushed a commit to manhatsu/safety-critical-rust-coding-guidelines that referenced this pull request Dec 4, 2025
* new arithmetic overflow rule

* Update expressions.rst

fixed a bunch of small problems and started adding compliant solutions using saturation semantics

* Update expressions.rst

adding Wrapping<T> example

* Revise arithmetic overflow guidelines and examples

Revised guidelines on arithmetic overflow, emphasizing prevention and the use of explicit wrapping functions. Updated examples to reflect compliant practices with saturation semantics.

* Update src/coding-guidelines/expressions.rst

Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>

* Update expressions.rst to specify integer types for overflow

Clarify guidelines on eliminating arithmetic overflow for various integer types.

* Update guidelines on arithmetic overflow handling

Clarify behavior of arithmetic overflow in Rust.

* Clarify arithmetic overflow behavior in expressions.rst

* rebase for fls errors

* Update src/coding-guidelines/expressions.rst

Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>

* Apply suggestion from @rcseacord

* Clarify arithmetic overflow handling and examples

Clarified behavior of arithmetic overflow in debug and release modes. Updated examples to emphasize the use of explicit wrapping and saturation semantics.

* Update src/coding-guidelines/expressions.rst

Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>

* Update src/coding-guidelines/expressions.rst

Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>

* Update print statement format in Rust example

* Update src/coding-guidelines/expressions.rst

Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>

* Update src/coding-guidelines/expressions.rst

Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>

* Update src/coding-guidelines/expressions.rst

Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>

* Update expressions.rst

---------

Co-authored-by: Félix Fischer <felix91gr@users.noreply.github.com>
@felix91gr felix91gr added the CERT C Issues or coding guidelines directly related to the CERT C Coding Guidelines label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CERT C Issues or coding guidelines directly related to the CERT C Coding Guidelines chapter: expressions coding guideline An issue related to a suggestion for a coding guideline

Development

Successfully merging this pull request may close these issues.

5 participants