This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: PR 57779 New debug check
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: François Dumont <frs dot dumont at gmail dot com>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 16 Jul 2013 15:16:46 +0100
- Subject: Re: PR 57779 New debug check
- References: <51DDC4A0 dot 6020008 at gmail dot com> <CAH6eHdS-X3B61M3+6NcYmiZ69Q80xda9JUMN7ciZgOC8=yZz8A at mail dot gmail dot com> <51DEE0A9 dot 9010809 at oracle dot com> <CAH6eHdQtkAqrDTsSQ5S7xE8P2ABK3JzOAuYNvAB7pxOGWprXSQ at mail dot gmail dot com> <51DF1291 dot 6040404 at gmail dot com> <CAH6eHdSdghzQ7NXQutXnVho6a=WVS-Dvnr37Q=myAEWVs2+JSA at mail dot gmail dot com> <CAH6eHdT=x7djoPSA1Ach9oeENEpz9WH8rGu5jSg4uiEwg+jowA at mail dot gmail dot com> <51E45AB2 dot 10000 at gmail dot com> <775842B8-CCCC-4126-9577-AF34711D5123 at oracle dot com>
On 15 July 2013 22:01, Paolo Carlini wrote:
> Hi,
>
> Il giorno 15/lug/2013, alle ore 13:25, François Dumont <frs.dumont@gmail.com> ha scritto:
>
>> Even if I still don't see what can goes wrong here I agree that in theory this is bad so here is another proposal that do not have this drawback. I also consider all your remarks I think except the Paolo remark about using std::greater. If I am playing with plain pointers why would I need to use std::less or std::greater ?
>
> The issue is well known, see the uses in basic_string for example, and it's about discontiguous memory, etc. The Standard explicitly discusses this case where std::less & co are specified. In short, if for a target, eg '<' doesn't make sense for arbitrary pointers,
See 5.9 [expr.rel] p2 (or p3 in the latest draft.)
> std::less does anyway (in that case an appropriate std::less shall be provided of course)
See 20.8.5 [comparisons] p8 (or 20.10.5 p14 in the latest draft.)