logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_COMPILE_TIME_ASSERT - A compile-time assertion.

Availability

       This macro is available since SDL 3.2.0.

Description

       This can check constant values _known to the compiler at build time_ for correctness, and end the compile
       with the error if they fail.

       Often times these are used to verify basic truths, like the size of a datatype is what is expected:

              SDL_COMPILE_TIME_ASSERT(uint32_size, sizeof(Uint32) == 4);

       The  name  parameter  must be a valid C symbol, and must be unique across all compile-time asserts in the
       same compilation unit (one run of the compiler), or the build might fail  with  cryptic  errors  on  some
       targets.   This  is  used with a C language trick that works on older compilers that don't support better
       assertion techniques.

       If you need an assertion that operates at runtime, on variable data, you should try SDL_assert
        instead.

Header File

       Defined in SDL3/SDL_stdinc.h

Name

       SDL_COMPILE_TIME_ASSERT - A compile-time assertion.

See Also

(3), SDL_assert(3)

Simple Directmedia Layer                           SDL 3.2.10                         SDL_COMPILE_TIME_ASSERT(3)

Synopsis

#include"SDL3/SDL.h"#defineSDL_COMPILE_TIME_ASSERT(name,x)FailToCompileIf_x_IsFalse(x)

Thread Safety

       This macro doesn't generate any code to run.

See Also