#81 Fix casting pointer to different size integer#23
Merged
ooxi merged 1 commit intogerbv:mainfrom Sep 16, 2021
Merged
Conversation
But changed 'uintptr_t' to 'size_t' as opening a .gvp file on Windows always crash I re-tested also on Linux https://sourceforge.net/p/gerbv/patches/81/
Collaborator
|
If you are worried about a cast from one type to another type of a different size, the best protection is to have the compiler enforce it. static_assert(sizeof(uintptr_t) == sizeof(cp))This solution will catch bugs on all architectures, even ones that we haven't encountered yet. It's nice when we have have the computer find our bugs for us automatically. |
Contributor
|
to me seems a good idea. Please add a PR for this |
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.
src/scheme.chas the problem of casting pointers to int of different sizes. This problem becomes apparent in 64-bit compilers.But changed
uintptr_ttosize_tas discussed in Pull Request #20 by @efaSee SourceForge patch #81 by Hiroshi Yoshikawa