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/unistd.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/unistd.h') diff --git a/include/unistd.h b/include/unistd.h index 13064026..ee2dbe8a 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -15,7 +15,9 @@ extern "C" { #define SEEK_CUR 1 #define SEEK_END 2 -#ifdef __cplusplus +#if __cplusplus >= 201103L +#define NULL nullptr +#elif defined(__cplusplus) #define NULL 0L #else #define NULL ((void*)0) -- cgit v1.2.1