From 0f8819f4f98b5c03bcfaf495b27269d5f35c235c Mon Sep 17 00:00:00 2001 From: Changkun Ou Date: Tue, 20 Oct 2020 07:44:21 +0200 Subject: [PATCH] book: remove nullptr 0L condition This is a bug introduced in #132. Fixes #136 --- book/en-us/02-usability.md | 3 +-- book/zh-cn/02-usability.md | 3 +-- code/2/2.01.nullptr.cpp | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/book/en-us/02-usability.md b/book/en-us/02-usability.md index c5a4cd8..00e3588 100644 --- a/book/en-us/02-usability.md +++ b/book/en-us/02-usability.md @@ -53,8 +53,7 @@ void foo(char *); void foo(int); int main() { - if (std::is_same::value || - std::is_same::value) + if (std::is_same::value) std::cout << "NULL == 0" << std::endl; if (std::is_same::value) std::cout << "NULL == (void *)0" << std::endl; diff --git a/book/zh-cn/02-usability.md b/book/zh-cn/02-usability.md index 6b82dc2..1d30be4 100644 --- a/book/zh-cn/02-usability.md +++ b/book/zh-cn/02-usability.md @@ -43,8 +43,7 @@ void foo(char *); void foo(int); int main() { - if (std::is_same::value || - std::is_same::value) + if (std::is_same::value) std::cout << "NULL == 0" << std::endl; if (std::is_same::value) std::cout << "NULL == (void *)0" << std::endl; diff --git a/code/2/2.01.nullptr.cpp b/code/2/2.01.nullptr.cpp index 9b8c80a..8fc1763 100644 --- a/code/2/2.01.nullptr.cpp +++ b/code/2/2.01.nullptr.cpp @@ -14,8 +14,7 @@ void foo(char *); void foo(int); int main() { - if (std::is_same::value || - std::is_same::value) + if (std::is_same::value) std::cout << "NULL == 0" << std::endl; if (std::is_same::value) std::cout << "NULL == (void *)0" << std::endl;