This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Remove redundant conditional expressions in <system_error>


This is silly and makes it harder to read:

return _M_value != 0 ? true : false;
Tested powerpc64le-linux, committed to trunk.


commit ca8d1e0e92810ac72b337247c10af1de1de465d4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Sep 17 15:07:24 2015 +0100

    Remove redundant conditional expressions in <system_error>
    
    	* include/std/system_error (error_code::operator bool(),
    	error_condition::operator bool()): Remove redundant conditional
    	expression.

diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
index 92f8af9..cc82bdf 100644
--- a/libstdc++-v3/include/std/system_error
+++ b/libstdc++-v3/include/std/system_error
@@ -181,7 +181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return category().message(value()); }
 
     explicit operator bool() const noexcept
-    { return _M_value != 0 ? true : false; }
+    { return _M_value != 0; }
 
     // DR 804.
   private:
@@ -257,7 +257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return category().message(value()); }
 
     explicit operator bool() const noexcept
-    { return _M_value != 0 ? true : false; }
+    { return _M_value != 0; }
 
     // DR 804.
   private:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]