From a05cdd7ea3167906795d6610cf1c2f3fc9f7cd6e Mon Sep 17 00:00:00 2001 From: insideoutclub Date: Thu, 2 Mar 2017 13:36:55 -0800 Subject: [PATCH] Update example13.cpp --- examples/example13.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/example13.cpp b/examples/example13.cpp index 3bf7ee9..2e3ce16 100644 --- a/examples/example13.cpp +++ b/examples/example13.cpp @@ -4,9 +4,9 @@ #include "../include/safe_integer.hpp" int main(int argc, const char * argv[]){ - // problem: checking of externally produced value can be overlooked + // problem: cannot recover from arithmetic errors std::cout << "example 7: "; - std::cout << "cannot recover From arithmetic errors" << std::endl; + std::cout << "cannot recover from arithmetic errors" << std::endl; std::cout << "Not using safe numerics" << std::endl; try{ @@ -21,14 +21,14 @@ int main(int argc, const char * argv[]){ std::cout << "error detected!" << std::endl; } - // solution: assign externally retrieved values to safe equivalents + // solution: replace int with safe std::cout << "Using safe numerics" << std::endl; try{ using namespace boost::numeric; safe x = 1; safe y = 0; std::cout << x / y; - std::cout << " error detected!" << std::endl; + std::cout << " error NOT detected!" << std::endl; } catch(std::exception & e){ std::cout << e.what() << std::endl;