SDL_ALLOC_SIZE(3)
β¨ SDL_ALLOC_SIZE β¨
okay bestie, welcome to the SDL_ALLOC_SIZE page, a macro from the SDL3 functions family that tags a function as returning a certain allocation π
π NAME π
SDL_ALLOC_SIZE β a macro that tags a function as returning a certain allocation π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_begin_code.h>
#define SDL_ALLOC_SIZE(p) __attribute__((alloc_size(p)))
π¦ DESCRIPTION π¦
so what does this actually do? it's a hint to the compiler that a function allocates and returns a specific amount of memory, and that the amount is based on one of its arguments. that's it. that's the whole vibe. β¨
like, picture the C runtime's malloc() function. it could totally use this macro with an argument of 1, because the first argument to malloc is the size of the allocation. iconic behavior, honestly π
on compilers that don't have alloc_size support, this macro is defined to nothing. so it just... evaporates. no drama, no errors, just vibes π«Ά
β οΈ real talk though: most apps don't need to use this directly, and should not use it directly. it's giving internal-tool energy. leave it to the library, bestie π
π AVAILABILITY π
this macro has been available since SDL 3.2.0. periodt π
and that's the whole page, no cap πΈ brought to you by Simple Directmedia Layer, SDL 3.4.18, mwah π go forth and let the compiler cook π
π¦ 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