0 is a terrible definition of NULL.  If possible, that is, for C++11 or
later, define is as nullptr.

Link: <https://software.codidact.com/posts/292718>
Signed-off-by: Alejandro Colomar <a...@kernel.org>
---
 gcc/ginclude/stddef.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 4d04b0163d5..3d9e9ae53b5 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -401,7 +401,11 @@ typedef __WINT_TYPE__ wint_t;
 #  define NULL __null
 # else   /* G++ */
 #  if defined(__cplusplus)
-#   define NULL 0
+#   if (__cplusplus >= 201103L)
+#    define NULL nullptr
+#   else
+#    define NULL 0
+#   endif
 #  else   /* C++ */
 #   define NULL ((void *)0)
 #  endif  /* C++ */
-- 
2.45.2

Attachment: signature.asc
Description: PGP signature

Reply via email to