SDL 3.0
|
Go to the source code of this file.
Macros | |
Internal error functions | |
Private error reporting function - used internally. | |
#define | SDL_Unsupported() SDL_SetError("That operation is not supported") |
#define | SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) |
Functions | |
int | SDL_SetError (SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1) |
int | SDL_OutOfMemory (void) |
const char * | SDL_GetError (void) |
int | SDL_ClearError (void) |
#define SDL_InvalidParamError | ( | param | ) | SDL_SetError("Parameter '%s' is invalid", (param)) |
Definition at line 134 of file SDL_error.h.
#define SDL_Unsupported | ( | ) | SDL_SetError("That operation is not supported") |
Definition at line 133 of file SDL_error.h.
|
extern |
Clear any previous error message for this thread.
|
extern |
Retrieve a message about the last error that occurred on the current thread.
It is possible for multiple errors to occur before calling SDL_GetError(). Only the last error is returned.
The message is only applicable when an SDL function has signaled an error. You must check the return values of SDL function calls to determine when to appropriately call SDL_GetError(). You should not use the results of SDL_GetError() to decide if an error has occurred! Sometimes SDL will set an error string even when reporting success.
SDL will not clear the error string for successful API calls. You must check return values for failure cases before you can assume the error string applies.
Error strings are set per-thread, so an error set in a different thread will not interfere with the current thread's operation.
The returned value is a thread-local string which will remain valid until the current thread's error string is changed. The caller should make a copy if the value is needed after the next SDL API call.
|
extern |
Set an error indicating that memory allocation failed.
This function does not do any memory allocation.
|
extern |
Simple error message routines for SDL. Set the SDL error message for the current thread.
Calling this function will replace any previous error message that was set.
This function always returns -1, since SDL frequently uses -1 to signify an failing result, leading to this idiom:
fmt | a printf()-style message format string. |
... | additional parameters matching % tokens in the fmt string, if any. |