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

aliasing violations #15

Open
kjsdf7wr3 opened this issue Nov 19, 2021 · 0 comments
Open

aliasing violations #15

kjsdf7wr3 opened this issue Nov 19, 2021 · 0 comments

Comments

@kjsdf7wr3
Copy link

Code like the following violates aliasing rules, an object shall only be accessed through its declared type or through a char pointer.
I think only the only legal way is to use memcpy (or assembly). Type punning through unions does not help here.

#define cw_store32(x) *(uint32_t*)p = (uint32_t)x;

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

No branches or pull requests

1 participant