Re: [Boost-bugs] [Boost C++ Libraries] #3418: phoenix/starter_kit: broken is_odd

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3418: phoenix/starter_kit: broken is_odd
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-09-08 19:36:26


#3418: phoenix/starter_kit: broken is_odd
----------------------------------+-----------------------------------------
 Reporter: olafvdspek@… | Owner: djowel
     Type: Bugs | Status: new
Milestone: Boost 1.41.0 | Component: spirit
  Version: Boost 1.40.0 | Severity: Problem
 Keywords: |
----------------------------------+-----------------------------------------

Comment(by steven_watanabe):

 Details:

 From 5.6 "If both operands are nonnegative then the remainder is
 nonnegative;
 if not, the sign of the remainder is implementation-defined."

 The implementation is

 {{{
 bool
 is_odd(int arg1)
 {
     return arg1 % 2 == 1;
 }
 }}}

 The correct test is

 {{{
 bool
 is_odd(int arg1)
 {
     return arg1 % 2 != 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3418#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC