From dd0536b1706f001c9c3b00b67f4a70e36ffba2c7 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 30 May 2026 02:25:16 +0200 Subject: [PATCH] stdinc: only use _Countof for SDL_arraysize when using a C standard > C23 --- include/SDL3/SDL_stdinc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 3a7920abeb..67347c9d4d 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -256,7 +256,8 @@ void *alloca(size_t); #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) /* or `_Countof(array)` on recent gcc and clang */ #else -#if !defined(__cplusplus) && ((defined(__GNUC__) && __GNUC__ >= 16) || SDL_HAS_EXTENSION(c_countof)) +#if !defined(__cplusplus) && ((defined(__GNUC__) && __GNUC__ >= 16) || SDL_HAS_EXTENSION(c_countof)) \ + && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202500L) #define SDL_arraysize(array) _Countof(array) #else #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))