diff options
author | Ismael Luceno <ismael@iodev.co.uk> | 2021-08-15 17:51:57 +0200 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2021-11-29 17:45:21 -0500 |
commit | 98e688a9da5e7b2925dda17a2d6820dddf1fb287 (patch) | |
tree | 5ed7c1b59b7688980996dfb6a2954e1b8b53bf70 /include/stddef.h | |
parent | 8274aaaaa1948c50c661aa32e21b3db27a5c0eab (diff) | |
download | musl-98e688a9da5e7b2925dda17a2d6820dddf1fb287.tar.gz musl-98e688a9da5e7b2925dda17a2d6820dddf1fb287.tar.xz musl-98e688a9da5e7b2925dda17a2d6820dddf1fb287.zip |
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.
Diffstat (limited to 'include/stddef.h')
-rw-r--r-- | include/stddef.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/stddef.h b/include/stddef.h index bd753853..f25b8639 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -1,7 +1,9 @@ #ifndef _STDDEF_H #define _STDDEF_H -#ifdef __cplusplus +#if __cplusplus >= 201103L +#define NULL nullptr +#elif defined(__cplusplus) #define NULL 0L #else #define NULL ((void*)0) |