about summary refs log tree commit diff
path: root/include/string.h
diff options
context:
space:
mode:
authorIsmael Luceno <ismael@iodev.co.uk>2021-08-15 17:51:57 +0200
committerRich Felker <dalias@aerifal.cx>2021-11-29 17:45:21 -0500
commit98e688a9da5e7b2925dda17a2d6820dddf1fb287 (patch)
tree5ed7c1b59b7688980996dfb6a2954e1b8b53bf70 /include/string.h
parent8274aaaaa1948c50c661aa32e21b3db27a5c0eab (diff)
downloadmusl-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/string.h')
-rw-r--r--include/string.h4
1 files changed, 3 insertions, 1 deletions
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 <features.h>
 
-#ifdef __cplusplus
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#elif defined(__cplusplus)
 #define NULL 0L
 #else
 #define NULL ((void*)0)