compilersupport: add support for C23's nullptr

It has the same semantics as C++11's `nullptr`.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Thiago Macieira
2025-12-01 13:25:03 -08:00
parent 17362494e2
commit 09496c6432
+5 -1
View File
@@ -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