SDL_IN_BYTECAP(3)
π SDL_IN_BYTECAP(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_IN_BYTECAP β a lil macro that annotates function params with input buffer size. no cap, that's literally all it does, and it's iconic for it. π
β¨ NAME β¨
SDL_IN_BYTECAP β macro that annotates function params with input buffer size. that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
copy that include exactly, bestie, character for character. π
π«Ά DESCRIPTION π«Ά
so here's the tea. say we wanted to annotate memcpy, right? like this:
void *memcpy(void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
what this is doing is noting that src should be len bytes in size, and that it's only read by the function. that's it, that's the note. π
and because that note is there, the compiler or other analysis tools can warn you when this doesn't appear to be the case. like a lil friend going "bestieβ¦ that buffer is NOT len bytes, I'm gonna need you to look at that". πβ¨
and on compilers without this annotation mechanism? it's defined to nothing. fr fr, it just vanishes. poof. π«₯ the code still compiles, the annotation just doesn't exist. no drama, no warnings, no vibe check.
β AVAILABILITY β
this macro is available since SDL 3.2.0. so if you're on something older, it's givingβ¦ not here yet. π
and that's the whole page, periodt. thanks for reading, you ate. π
signing off from the Simple Directmedia Layer besties β this was SDL 3.4.18, page SDL_IN_BYTECAP(3). mwah, take care of your buffers. ππ
π¦ 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