begin_code: Added SDL_ALIGNED macro. #13132
Merged
+57
−0
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.
I'm running into places where I want to define data that is aligned for SSE or NEON access, so being able to tell the compiler "this struct (or struct member) needs to be aligned to 16 bytes" or "this stack variable needs to be aligned" becomes essential.
All compilers supporting C11 or C++11 support a keyword for this, and GCC/Clang/MSVC all have their own syntax to handle it, long before those standards.
I'm torn about what to do on compilers that don't support it (which is...possible no significant compilers). Seeing as they will definitely miscompile code in that case, I have it intentionally generate an error; the docs currently say it the macro defined in this case, the code currently defines it to something like an error message. It's not clear to me which approach is better, or if defining it to nothing is better to let the compiler roll the dice.