SDL_ANALYZER_NORETURN(3)
π SDL_ANALYZER_NORETURN π
okay bestie, this one's a macro from the SDL3 FUNCTIONS manual, and it's a lil niche but honestly so smart. let's get into it β¨
πΈ NAME πΈ
SDL_ANALYZER_NORETURN β a macro that tags a function as never-returning, but likeβ¦ for analysis purposes only. π
π SYNOPSIS π
#include <SDL3/SDL_begin_code.h>
#define SDL_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
π¦ DESCRIPTION π¦
so here's the tea β β this is almost identical to SDL_NORETURN, with one iconic lil plot twist: functions marked with this one can actually return. π± the way that changes everythingβ¦
the difference is that SDL_ANALYZER_NORETURN is not used for code generation. instead, it's static analyzers that read this info and use it to assume truths about your program state and which code paths are even available. it's giving "trust me bestie, I know things." π
specifically, this tag is so useful when you're writing an assertion mechanism. in fact β plot twist β SDL_assert uses this tag behind the scenes. slay. π
β οΈ okay but real talk: if your app doesn't understand the specific use-case for this tag, you should genuinely just avoid using it directly. it's not for casual use, bestie, it's a specialist. π
on compilers that don't have analyzer_noreturn support, this macro is defined to nothing. so it just vibes there, doing zero. π
and yes β this symbol is used in SDL's own headers, but apps and other libraries are totally welcome to use it for their own interfaces too. sharing is caring fr fr. π«Ά
π AVAILABILITY π
this macro has been available since SDL 3.2.0. so if you're on anything olderβ¦ no it isn't. π
π one more time for the people in the back: can return. not codegen. analyzers only. SDL_assert-coded. define-to-nothing on compilers that don't get it.
and that's the whole page, bestie β no notes, she ate. β¨π from the Simple Directmedia Layer crew, SDL 3.4.18 era, brought to you by the SDL3 FUNCTIONS manual. 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