Subject: Re: [boost] [Boost.Pool] TR1?
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-04-13 18:26:59
At Wed, 13 Apr 2011 14:17:15 -0700,
Phil Bouchard wrote:
> > To make is_from work, we need a total, *specified* ordering for all
> > pointers. I see no way to combine the above two to get a total specified
> > ordering.
> There is s bug in the standards because according to 5.2.10/4 a
> pointer can be converted to an integral type to later be ordered.
> struct Silly
> bool is_from(const char* p)
> return !std::less<long>()(reinterpret_cast<long>(p),
> reinterpret_cast<long>(buffer)) &&
> reinterpret_cast<long>(buffer + sizeof(buffer)));
> char buffer;
Stop, stop, seriously. That's not a bug, and your code isn't
guaranteed to produce any particular result either, portably.
reinterpret_cast has unspecified or implementation-defined results (I
forget which) in this case.
If you don't believe me, take the question to some "higher authority"
on the C++ core standard, such as you might find on comp.std.c++, but
please stop wasting time arguing with me about it in this forum.
I fear my whole point was missed: since there's no way to implement
is_from in portable standard-compliant user code, it makes sense that
(if it's actually broadly needed) it should go in the standard as you
suggested, and as a first step, it should go in Boost.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com