|
Boost : |
Subject: Re: [boost] [Boost.Pool] TR1?
From: Nevin Liber (nevin_at_[hidden])
Date: 2011-04-12 13:15:56
On 12 April 2011 11:53, Phil Bouchard <philippe_at_[hidden]> wrote:
> On 4/12/2011 8:04 AM, Dave Abrahams wrote:
>
>>
>> I think you are severely missing the point: it is not implementable, no
>> matter the cost in complexity, without causing undefined behavior. You're
>> just not allowed to compare arbitrary pointers with<, and the total
>> ordering produce by std::less isn't guaranteed to be meaningful.
>>
>
> Thanks for the clarifications but if the stack and data segments were part
> of a pool then 'false' returned by is_from() would then be a valid according
> to the definition of is_from().
>
Only if it is implemented the way Steven described it. You cannot legally
compare pointers using relationship operators (<, <=, >, >=) unless at least
one is NULL, they are both pointing within the same object, or both pointing
within the same array (or just past the end of the array). All other
comparisons are undefined behavior. See 6.5.8 of the C99 standard for a
much more precise definition.
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden]> (847) 691-1404
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk