SDL_memset(3)
β¨ SDL_memset β¨
okay bestie, so this one's from the SDL3 FUNCTIONS fam, and it's literally the glow-up you need when you wanna paint a chunk of memory one single byte at a time π
πΈ NAME πΈ
SDL_memset β Initialize all bytes of buffer of memory to a specific value.
like. every single byte. same value. no cap. π«Ά
π SYNOPSIS π
#include <SDL3/SDL_stdinc.h>
void * SDL_memset(void *dst, int c, size_t len);
π DESCRIPTION π
okay so here's the tea β: this function will set len bytes, pointed to by dst, to the value specified in c. that's it, that's the whole vibe. she's simple, she's reliable, she's the main character of memory-filling π¦
but bestie, listen β this is the part where you gotta pay attention, no skipping π despite c being an int instead of a char, this only operates on bytes. so c must be a value between 0 and 255, inclusive. that's the range. don't come at her with 256, she will simply not know what to do with you π
π FUNCTION PARAMETERS π
dstβ the destination memory region. Must not beNULL. (fr fr, do not do that. that's not a vibe, that's undefined behavior territory π)cβ the byte value to set.lenβ the length, in bytes, to set indst.
β RETURN VALUE β
Returns dst. she gives you back exactly what you handed her, which is honestly so iconic of her π
π§ THREAD SAFETY π§
It is safe to call this function from any thread. go off, multithreaded queen πΈβ¨
π₯ AVAILABILITY π₯
This function is available since SDL 3.2.0. so if you're on anything older... bestie, upgrade. iykyk π
not me writing a whole manpage about filling memory with one byte... and meaning every word of it π
mwah π that's the page! brought to you by Simple Directmedia Layer, version SDL 3.4.18, dated... whenever this one dropped π stay hydrated, stay aligned, and may all your bytes be exactly the value you asked for π¦π
π¦ 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