musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/include/time.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/time.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/time.h')
-rw-r--r--include/time.h 4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/time.h b/include/time.h
index 5494df18..3d948372 100644
--- a/include/time.h
+++ b/include/time.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)
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月03日 20:33:05 +0000

AltStyle によって変換されたページ (->オリジナル) /