summaryrefslogtreecommitdiff
path: root/include/unistd.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/unistd.h
parent8274aaaaa1948c50c661aa32e21b3db27a5c0eab (diff)
downloadmusl-98e688a9da5e7b2925dda17a2d6820dddf1fb287.tar.gz
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/unistd.h')
-rw-r--r--include/unistd.h4
1 files changed, 3 insertions, 1 deletions
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)