Use restrict keyword to enforce unaliased pointer args#130
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #130 +/- ##
==========================================
- Coverage 99.59% 99.54% -0.06%
==========================================
Files 8 8
Lines 3932 3930 -2
Branches 708 707 -1
==========================================
- Hits 3916 3912 -4
- Misses 3 4 +1
- Partials 13 14 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
restrict keyword to enforce unaliased pointer args
6d30f95 to
f557694
Compare
f557694 to
65bb46c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
restrictkeyword, introduced in C99, indicates that the data referenced by the marked pointers is not overlapping with other data for the lifetime of the pointer. It is useful to demark pointer arguments to functions, which should be distinct from other arguments, with no overlapping data between the demarked pointer argument and other arguments passed. Modern compilers will also warn if the user calls function with overlapping data when they aren't supposed to. Thus, it adds another level of compiler checking to prevent against improper usage.