[PPL-devel] [GIT] ppl/ppl(master): Avoid implicit conversions to bool.

Enea Zaffanella zaffanella at cs.unipr.it
Mon Mar 12 13:53:38 CET 2012


Module: ppl/ppl
Branch: master
Commit: 15351dec0d694afe3fc73174a5833f009fd26dc4
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=15351dec0d694afe3fc73174a5833f009fd26dc4

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Mon Mar 12 13:53:04 2012 +0100

Avoid implicit conversions to bool.
Detected by ECLAIR service utypflag.

---

 demos/ppl_lcdd/ppl_lcdd.cc |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/demos/ppl_lcdd/ppl_lcdd.cc b/demos/ppl_lcdd/ppl_lcdd.cc
index 71f22a4..744c696 100644
--- a/demos/ppl_lcdd/ppl_lcdd.cc
+++ b/demos/ppl_lcdd/ppl_lcdd.cc
@@ -504,7 +504,8 @@ template <typename T>
 bool
 guarded_read(std::istream& in, T& x) {
   try {
-    return in >> x;
+    in >> x;
+    return !in.fail();
   }
   catch (...) {
     return false;
@@ -516,7 +517,8 @@ void
 guarded_write(std::ostream& out, const T& x) {
   bool succeeded = false;
   try {
-    succeeded = out << x;
+    out << x;
+    succeeded = !out.fail();
   }
   catch (...) {
   }
@@ -1161,7 +1163,8 @@ write_polyhedron(std::ostream& out,
   // Flush `out'.
   bool flush_succeeded = false;
   try {
-    flush_succeeded = out.flush();
+    out.flush();
+    flush_succeeded = !out.fail();
   }
   catch (...) {
   }




More information about the PPL-devel mailing list