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