lkml.org 
[lkml]   [2018]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 06/45] C++: Do some basic C++ type definition
From
Date
NULL should be defined as nullptr rather than (void *)0 as nullptr is a
special compiler type.

Don't define bool, true and false as these are defined by the compiler.

Signed-off-by: David Howells <dhowells@redhat.com>
---

include/linux/stddef.h | 12 ++++++------
include/linux/types.h | 2 --
2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index 998a4ba28eba..470cf32e9119 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -4,13 +4,13 @@

#include <uapi/linux/stddef.h>

-#undef NULL
-#define NULL ((void *)0)
+/*
+ * The type of the NULL pointer. This is a special C++ pointer type.
+ */
+typedef decltype(nullptr) nullptr_t;

-enum {
- false = 0,
- true = 1
-};
+#undef NULL
+#define NULL nullptr

#undef offsetof
#ifdef __compiler_offsetof
diff --git a/include/linux/types.h b/include/linux/types.h
index 31e8258ac048..68323cb03910 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -31,8 +31,6 @@ typedef __kernel_timer_t timer_t;
typedef __kernel_clockid_t clockid_t;
typedef __kernel_mqd_t mqd_t;

-typedef _Bool bool;
-
typedef __kernel_uid32_t uid_t;
typedef __kernel_gid32_t gid_t;
typedef __kernel_uid16_t uid16_t;
\
 
 \ /
  Last update: 2018-04-01 22:50    [W:0.103 / U:2.100 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site