From 4b0f2e5edcebd8110202f6fb867ca7a3f244a4e4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 27 Nov 2025 18:27:27 -0800 Subject: [PATCH] compilersupport: add support for C23's `nullptr` It has the same semantics as C++11's `nullptr`. Signed-off-by: Thiago Macieira --- src/compilersupport_p.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compilersupport_p.h b/src/compilersupport_p.h index 92517997..4baf9bd5 100644 --- a/src/compilersupport_p.h +++ b/src/compilersupport_p.h @@ -202,10 +202,14 @@ #ifdef __cplusplus # define CONST_CAST(t, v) const_cast(v) -# define CBOR_NULLPTR nullptr #else /* C-style const_cast without triggering a warning with -Wcast-qual */ # define CONST_CAST(t, v) (t)(uintptr_t)(v) +#endif + +#if defined(__cplusplus) || __STDC_VERSION__ >= 202311 +# define CBOR_NULLPTR nullptr +#else # define CBOR_NULLPTR NULL #endif