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

SDL_malloc alignment properties unspecified in documentation #11961

Open
Beyley opened this issue Jan 15, 2025 · 0 comments
Open

SDL_malloc alignment properties unspecified in documentation #11961

Beyley opened this issue Jan 15, 2025 · 0 comments
Milestone

Comments

@Beyley
Copy link

Beyley commented Jan 15, 2025

SDL3's documentation does not specify a minimum alignment of SDL_malloc, implying it could return data with no guaranteed alignment, meaning there's many cases like SDL_ConvertAudioSamples where the returned pointer by SDL cannot be trivially casted to a it's true data type (eg. if im telling SDL to resample to f32 audio, I cannot safely cast the u8* (natural alignment 1) pointer SDL gives me to an f32* (natural alignment 4), which seems like an oversight).

If SDL_malloc should always return at least some minimum of alignment for its data, this should be documented, else, places like SDL_ConvertAudioSamples should be changed to allocate aligned memory themselves.

@slouken slouken added this to the 3.x milestone Jan 15, 2025
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

2 participants