SDL_FunctionPointer(3type)
β¨ SDL_FunctionPointer(3type) β¨
okay so bestie, pull up a chair, because we're talking about SDL_FunctionPointer(3type) β a lil datatype from the SDL3 DATATYPES section of the manual and honestly? she's iconic for a reason. π
πΈ NAME πΈ
SDL_FunctionPointer β a generic function pointer. that's it. that's the whole vibe. π«Ά
π SYNOPSIS π
#include <SDL3/SDL_stdinc.h>
typedef void (*SDL_FunctionPointer)(void);
look at her. one line. no drama. no cap. β¨
π DESCRIPTION π
so like, in theory, when you want a generic function pointer, you should be using this instead of void *. why? because some platforms could treat code addresses differently than data addresses. π like, the address of a function and the address of your data are not necessarily the same kind of beast on every system out there.
now, in current times no popular platforms make this distinction β so if you've been raw-dogging void * for function pointers this whole time, nobody's gonna come for you. but it is more correct and more portable to use the correct type for a generic pointer. main character behavior, honestly. π
so like... use the right type. it's giving "I read the docs" energy and we love that for you. π
if for some reason you need to force this typedef to be an actualvoid *β maybe to work around a compiler, or because of some existing code that refuses to cooperate β you can defineSDL_FUNCTION_POINTER_IS_VOID_POINTERbefore including any SDL headers. not before. not after. before. okay bestie? before. π
β AVAILABILITY β
this datatype is available since SDL 3.2.0. so if you're on something older, she's simply not there yet, and you're gonna have to cope. π
and that's the whole page, bestie!! written by the lovely folks at Simple Directmedia Layer, sitting pretty at version SDL 3.4.18 β thanks for coming to my TED talk, go use the correct pointer type, mwah π π¦ πΈ
π¦ 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