Opened 13 years ago
Closed 12 years ago
#3418 closed Bugs (fixed)
phoenix/starter_kit: broken is_odd
| Reported by: | Owned by: | Joel de Guzman | |
|---|---|---|---|
| Milestone: | Boost 1.41.0 | Component: | spirit |
| Version: | Boost 1.40.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
is_odd is broken for negative ints.
Note:
See TracTickets
for help on using tickets.

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; }