SDL_RESTRICT(3)
β¨ SDL_RESTRICT β¨
ok bestie gather round, we're talking about SDL_RESTRICT from the SDL3 functions era π
this one's a macro, and it's lowkey one of those tiny things that makes compilers behave. come sit with me π«Ά
πΈ NAME πΈ
SDL_RESTRICT β a macro that tags a pointer variable, and its whole job is helping out with pointer aliasing. no cap.
π SYNOPSIS π
#include <SDL3/SDL_begin_code.h>
#define SDL_RESTRICT __restrict
like, that's it. that's the whole thing. iconic minimalism honestly β¨
π¦ DESCRIPTION π¦
so restrict is a keyword, right, and if you want a genuinely good explanation of what it does, the original peeps point you here:
https://en.wikipedia.org/wiki/Restrict
go read it, it's giving "actually useful reference material" π
and here's the part where SDL is being a considerate bestie: on compilers that don't support restrict at all, SDL_RESTRICT is defined to nothing. so it justβ¦ vanishes. no error, no drama, no nothing. the code still compiles. periodt π
β AVAILABILITY β
this macro has been available since SDL 3.4.0. she's new-ish, she's cute, she's ready π
π reminder bestie: everything above is literally what it does, no more no less. the macro is the vibe, the vibe is the macro.
mwah π that's the whole page! sending you off with the classic sign-off: this beauty comes from Simple Directmedia Layer, sitting pretty at SDL 3.4.18 β go forth and tag your pointers, you absolute main character πβ¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms