Skip to content

Commit 09496c6

Browse files
compilersupport: add support for C23's nullptr
It has the same semantics as C++11's `nullptr`. Signed-off-by: Thiago Macieira <[email protected]>
1 parent 1736249 commit 09496c6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/compilersupport_p.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,14 @@
202202

203203
#ifdef __cplusplus
204204
# define CONST_CAST(t, v) const_cast<t>(v)
205-
# define CBOR_NULLPTR nullptr
206205
#else
207206
/* C-style const_cast without triggering a warning with -Wcast-qual */
208207
# define CONST_CAST(t, v) (t)(uintptr_t)(v)
208+
#endif
209+
210+
#if defined(__cplusplus) || __STDC_VERSION__ >= 202311
211+
# define CBOR_NULLPTR nullptr
212+
#else
209213
# define CBOR_NULLPTR NULL
210214
#endif
211215

0 commit comments

Comments
 (0)