Subject: Re: [boost] [Boost.Pool] TR1?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-04-13 23:56:30
On 04/13/2011 08:32 PM, Phil Bouchard wrote:
> On 4/13/2011 3:45 PM, Phil Bouchard wrote:
>> On 4/13/2011 3:26 PM, Dave Abrahams wrote:
>>> 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.
>> It's implementation defined.
> Please apologize my tenacity but the C standard defines intptr_t to be
> the same size as a pointer.
You're missing the point. The only thing the standard
guarantees about casting a pointer to intptr_t is
that it's reversible.
> This is defined in "cstdint" so
> consequently we could use:
> struct Silly
> bool is_from(const char* p)
> return !std::less<intptr_t>()(reinterpret_cast<intptr_t>(p),
> reinterpret_cast<intptr_t>(buffer)) &&
> reinterpret_cast<intptr_t>(buffer + sizeof(buffer)));
> char buffer;