SDL_NORETURN(3)

πŸ’… SDL_NORETURN πŸ’…

okay bestie, welcome to SDL_NORETURN β€” a macro that tags a function as never-returning. yes it's a whole vibe. this is the SDL3 FUNCTIONS page, and no, it's not as scary as it sounds 🫢


✨ NAME ✨

SDL_NORETURN β€” A macro to tag a function as never-returning. periodt. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_begin_code.h>

#define SDL_NORETURN __attribute__((noreturn))

like, that's the whole thing. short and iconic. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie: this is a hint to the compiler that a function does not return. like, ever. it goes in, it does its thing, and it never comes back. the classic example? the C runtime's exit() function. πŸ’€

this hint can lead to code optimizations, and it helps analyzers understand code flow better. basically it tells everyone "yeah, nothing after this call happens, don't worry about it."

and on compilers that don't have noreturn support? this is defined to nothing. no cap, it just poofs into the void. πŸ«₯

this symbol is used in SDL's headers, but apps and other libraries are welcome to use it for their own interfaces as well. it's not gatekept, it's for everyone. 🫢


⭐ AVAILABILITY ⭐

this macro is available since SDL 3.2.0. so if you're on anything older, sorry babe, no noreturn for you 😭


lowkey a tiny macro but highkey it's carrying the whole optimizer's understanding of your control flow. respect it. 🧚

and that's a wrap, bestie πŸ’– this was the SDL_NORETURN(3) page from Simple Directmedia Layer, SDL 3.4.18 edition. go forth and never return βœ¨πŸŒΈπŸŽ€

πŸ“¦ where this page comes from