Boost logo

Boost Users :

From: Ross Boylan (ross_at_[hidden])
Date: 2005-01-28 21:13:51


I have a function declared bool that is acting rather non-bool.
std::cout << obj.fn()
gives me "76" and
BOOST_CHECK_EQUAL(obj.fn), true)
fails, with the message
/home/ross/peter/R/mspath/src/test/Covariates_test.cc(178): error in
"obs_covariates": test env.matchesObservation() == true failed [76 != 1]

std::cout << true
prints "1".
obj.fn() works OK as an argument to if (obj.fn()).

I am using g++ 1:3.3.5-5 on Debian GNU/Linux. I've tried -O2 and -O1;
same behavior either way.

boost is 1.31.0-9

The function is declared
        bool matchesObservation() const

Maybe bool is being typedef'd or #define'd to int somewhere, for
compatibility with old code? Probably not; I tried printing
typeid(xxx).name() and got "b" for true and the function return value,
while I got "i" for the number 1.

I tried tracing into the code with limited success. Some mix of the
fact that the underlying libraries weren't a debug version, that the
code was optimized, and that there are #line directives (the source
files were generated out of another file) made it hard to follow.

Any suggestions?

-- 
Ross Boylan                                      wk:  (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4          ross_at_[hidden]
Dept of Epidemiology and Biostatistics           fax: (415) 476-9856
University of California, San Francisco
San Francisco, CA 94143-0840                     hm:  (415) 550-1062

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net