Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve robustness of ptr addition/subtraction. Enhance tests/ptr.c . #96

Merged
merged 2 commits into from
Jul 19, 2022

Conversation

HPCguy
Copy link
Contributor

@HPCguy HPCguy commented Jun 23, 2022

Pointer arithmetic was only working in a very narrow set of cases. For example, "5 - ptr;" was erroneously accepted. The expressions "int *p; 5 + p;" and "int i; ptr + i;" would produce incorrect results. Also, pointer arithmetic for arbitrarity sized structs was not well supported.

@HPCguy
Copy link
Contributor Author

HPCguy commented Jun 23, 2022

Closes #94 .

@HPCguy
Copy link
Contributor Author

HPCguy commented Jun 23, 2022

I would be happy to remove the 2^n optimizations in the subtraction operator if you would like to reduce code size.

@jserv jserv merged commit 38a3f5b into jserv:master Jul 19, 2022
@jserv
Copy link
Owner

jserv commented Jul 19, 2022

Thank @HPCguy for contributing!

@HPCguy HPCguy deleted the ptraddsub branch July 19, 2022 05:47
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.

None yet

2 participants