SDL_free_func(3type)

πŸ’– SDL_free_func β€” a lil datatype moment πŸ’–

okay bestie, welcome to SDL_free_func(3type), part of the SDL3 DATATYPES lineup. this is a whole typedef and it's honestly giving "callback royalty." let's get into it πŸŽ€


✨ NAME ✨

SDL_free_func β€” a callback that's used to implement SDL_free(). that's it, that's the vibe. she's the behind-the-scenes icon making your frees happen πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

typedef void (SDLCALL *SDL_free_func)(void *mem);

look at her. one pointer, no returns, pure void energy. slay ✨


✨ DESCRIPTION ✨

so here's the tea πŸ«– β€” SDL is always gonna make sure that the mem you get passed is a non-NULL pointer. no cap. like, you literally never have to check it yourself, SDL already did that for you. main character behavior from SDL tbh πŸ‘‘


✨ FUNCTION PARAMETERS ✨

  • mem β€” a pointer to allocated memory. that's your whole job bestie, take the pointer, free the pointer, live your truth πŸ¦‹

✨ THREAD SAFETY ✨

good news!! it should be safe to call this callback from any thread. so go off, thread it, do your thing, no drama πŸ’š


✨ AVAILABILITY ✨

this datatype has been around since SDL 3.2.0. vintage-ish, but make it fresh 🌸


✨ SEE ALSO ✨

go read those too, they're all part of the same memory-management friend group fr fr πŸ’œ


okay that's the whole page, you understood it, I'm so proud of you πŸ˜­πŸ’–

this has been your girl signing off from Simple Directmedia Layer, rockin' SDL 3.4.18, and the page you just read was SDL_free_func(3type). periodt. βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from