Skip to content

Use restrict keyword to enforce unaliased pointer args#130

Merged
attipaci merged 1 commit into
mainfrom
restrict-pointers
Feb 23, 2025
Merged

Use restrict keyword to enforce unaliased pointer args#130
attipaci merged 1 commit into
mainfrom
restrict-pointers

Conversation

@attipaci

@attipaci attipaci commented Feb 23, 2025

Copy link
Copy Markdown
Collaborator

The restrict keyword, 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.

@attipaci attipaci added the enhancement New feature or request label Feb 23, 2025
@attipaci attipaci added this to the 1.3.0 milestone Feb 23, 2025
@attipaci attipaci self-assigned this Feb 23, 2025
@codecov

codecov Bot commented Feb 23, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.54%. Comparing base (f3f7876) to head (65bb46c).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests 99.54% <100.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/frames.c 99.71% <100.00%> (ø)
src/novas.c 99.21% <100.00%> (-0.10%) ⬇️
src/nutation.c 100.00% <100.00%> (ø)
src/refract.c 100.00% <100.00%> (ø)
src/solsys3.c 100.00% <100.00%> (ø)
src/super.c 100.00% <100.00%> (ø)
src/timescale.c 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3f7876...65bb46c. Read the comment docs.

@attipaci attipaci changed the title Use restrict keyword to enforce unaliased pointer args Use restrict keyword to enforce unaliased pointer args Feb 23, 2025
@attipaci attipaci force-pushed the restrict-pointers branch 6 times, most recently from 6d30f95 to f557694 Compare February 23, 2025 20:22
@attipaci attipaci marked this pull request as ready for review February 23, 2025 20:33
@attipaci attipaci merged commit 979c3da into main Feb 23, 2025
@attipaci attipaci deleted the restrict-pointers branch February 23, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant