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

Use memcpy instead of *(int)*& #115

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open

Use memcpy instead of *(int)*& #115

wants to merge 1 commit into from

Conversation

Garfield1002
Copy link

The issues with *(int)*& are that

  • It is quite confusing (especially for C++ beginners)
  • In this case, it is a strict aliasing violation

A solution can therefore be to replace it with memcpy

I am only making a single PR, but this change (if approved) probably needs to be made in other locations.

This PR comes after a question I asked on StackOverflow

The issues with  `*(int)*&` are that
- It is quite confusing (especially for C++ beginners)
- In this case, it is a strict aliasing violation

A solution can therefore be to replace it with `memcpy`

_This PR comes after a question I asked on [StackOverflow](https://stackoverflow.com/questions/68699806/strange-c-type-casting)_
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.

1 participant