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/wchar.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/wchar.h') diff --git a/include/wchar.h b/include/wchar.h index 88eb55b1..ed5d774d 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -38,7 +38,9 @@ extern "C" { #define WCHAR_MIN (-1-0x7fffffff+L'\0') #endif -#ifdef __cplusplus +#if __cplusplus >= 201103L +#define NULL nullptr +#elif defined(__cplusplus) #define NULL 0L #else #define NULL ((void*)0) -- cgit v1.2.1