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

avoid null-pointer-subtraction error #78

Merged

Conversation

nitzmahone
Copy link
Member

Newer compilers generate warnings/errors about null pointer subtractions being an undefined behavior. Use matching non-zero offsets (as suggested by arigo) to avoid the error.

Newer compilers generate warnings/errors about null pointer subtractions being an undefined behavior. Use matching non-zero offsets (as suggested by arigo) to avoid the error.
@nitzmahone nitzmahone mentioned this pull request May 23, 2024
5 tasks
@nitzmahone nitzmahone merged commit 39bdab2 into python-cffi:main May 23, 2024
52 of 64 checks passed
@nekopsykose
Copy link

is there any reason to not make this offsetof(%s, %s) instead?

@arigo
Copy link
Contributor

arigo commented Jun 29, 2024

We can't in this case, because we have the name of the pointer type, and not the struct name type. See the next line after the else: for the case where we have the struct name and can just emit offsetof.

@nekopsykose
Copy link

that makes sense, thanks :)

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.

3 participants