SDL_HAS_BUILTIN(3)

✨ SDL_HAS_BUILTIN(3) ✨

okay so this one's from the SDL3 FUNCTIONS manual, and it's literally the cutest lil preprocessor vibe check for builtin compiler stuff πŸ’…


🌸 NAME 🌸

SDL_HAS_BUILTIN β€” check if the compiler supports a given builtin functionality.


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_begin_code.h>

#define SDL_HAS_BUILTIN(x) __has_builtin(x)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay bestie, here's the tea: this lets you do preprocessor checks for things that otherwise might fail to compile. no cap πŸ’–

It's supported by virtually all clang versions and more-recent GCCs. So if you can, use this instead of checking the clang version. iykyk ✨

On compilers without has_builtin support, this is defined to 0 (always false). periodt πŸ’€


πŸ’– AVAILABILITY πŸ’–

This macro is available since SDL 3.2.0. 🫢


xoxo, your SDL bestie πŸ’… β€” source/version: Simple Directmedia Layer, SDL 3.4.18, page SDL_HAS_BUILTIN(3) πŸŽ€

πŸ“¦ where this page comes from