Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-03-23 06:12:03


Hi Jonathan,

> The attached patch fixes a 64 bit portability problem where
> std::string::size_type is assigned to unsigned, which is shorter
> than size_t on x86-64 and so will be truncated. This means the
> following comparison to std::string::npos is always false.

Applied. Interesting, I'd say that a std::string of more that 4GB is a
terrible idea, performance wise, as many operations are linear on string
size. Do you know why it's decided to make size_type 64bit?

> Patch also prevents a warning with GCC; since the compiler doesn't
> know that boost::throw_exception never returns it thinks that
> cmdline::translate_property() can reach the end of the function without
> returning. The patch simply removes the "else" so that throw_exception
> is always called if control reaches the end of the function. A better
> solution might be to mark boost::throw_exception() with
> __attribute__((unused)) for GCC.

Shouldn't it be

   __attribute((noreturn))

? But anyway, that part of code is rewritten in my local copy and that
function is removed.

Thanks!

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk