Blast-Radius Aware AI Code Review for Business-Critical Systems
LiveReview LiveReview Explore LiveReview

SDL_SetError - Set the SDL error message for the current thread.

Availability

       This function is available since SDL 3.2.0.

Description

       Calling this function will replace any previous error message that was set.

       This  function always returns false, since SDL frequently uses false to signify a failing result, leading
       to this idiom:

              if (error_code) {
                  return SDL_SetError("This operation has failed: %d", error_code);
              }

Function Parameters

fmt    a printf()-style message format string.

       ...    additional parameters matching % tokens in the fmt string, if any.

Name

       SDL_SetError - Set the SDL error message for the current thread.

Return Value

       Returns false.

See Also

SDL_ClearError(3), SDL_GetError(3), SDL_SetErrorV(3)

Simple Directmedia Layer                           SDL 3.2.20                                    SDL_SetError(3)

Synopsis

#include<SDL3/SDL_error.h>boolSDL_SetError(constchar*fmt,...);

Thread Safety

       It is safe to call this function from any thread.

See Also