From 98e688a9da5e7b2925dda17a2d6820dddf1fb287 Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Sun, 15 Aug 2021 17:51:57 +0200 Subject: define NULL as nullptr when used in C++11 or later This should be safer for casting and more compatible with existing code bases that wrongly assume it must be defined as a pointer. --- include/string.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/string.h') diff --git a/include/string.h b/include/string.h index 795a2abc..43ad0942 100644 --- a/include/string.h +++ b/include/string.h @@ -7,7 +7,9 @@ extern "C" { #include -#ifdef __cplusplus +#if __cplusplus >= 201103L +#define NULL nullptr +#elif defined(__cplusplus) #define NULL 0L #else #define NULL ((void*)0) -- cgit 1.4.1