compilersupport: add support for C23's `nullptr`
It has the same semantics as C++11's `nullptr`.
Signed-off-by: Thiago Macieira <[email protected]>
diff --git a/src/compilersupport_p.h b/src/compilersupport_p.h
index 9251799..4baf9bd 100644
--- a/src/compilersupport_p.h
+++ b/src/compilersupport_p.h
@@ -202,10 +202,14 @@
#ifdef __cplusplus
# define CONST_CAST(t, v) const_cast<t>(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