[PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2020-10-07 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment. Also, regarding `allocator::pointer` vs raw pointers -- if someone defines a fancy pointer type whose `operator<` is significantly more costly than `operator!=`, I think this loop in libc++ is not the first thing that's going to bite them. I don't think that's the right

[PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2020-10-07 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment. In D17053#2315384 , @dexonsmith wrote: > In D17053#632700 , @EricWF wrote: > >> Maybe if we want to improve the failure mode we can add a >> `_LIBCPP_ASSERT(__new_last <= __end, "invalid ran

[PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2020-10-06 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith abandoned this revision. dexonsmith added subscribers: ldionne, EricWF. dexonsmith added a comment. Herald added a subscriber: ributzka. In D17053#632700 , @EricWF wrote: > Maybe if we want to improve the failure mode we can add a > `_LIBCPP_ASS

[PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2017-03-29 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF resigned from this revision. EricWF added a comment. This review seems stuck and dead. Resigning as a reviewer. Please re-add me if you want this revision to proceed. https://reviews.llvm.org/D17053 ___ cfe-commits mailing list cfe-commits@l

[PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-12-30 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. Maybe if we want to improve the failure mode we can add a `_LIBCPP_ASSERT(__new_last <= __end, "invalid range")`? https://reviews.llvm.org/D17053 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/

Re: [PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Howard Hinnant via cfe-commits
On Feb 9, 2016, at 7:46 PM, Duncan P. N. Exon Smith wrote: > > >> On 2016-Feb-09, at 16:40, Howard Hinnant wrote: >> >> On Feb 9, 2016, at 7:17 PM, Duncan P. N. Exon Smith via cfe-commits >> wrote: >>> >>> Any other ideas for improving the failure mode? >> >> Here’s a suggestion: >> >> h

Re: [PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Duncan P. N. Exon Smith via cfe-commits
> On 2016-Feb-09, at 16:40, Howard Hinnant wrote: > > On Feb 9, 2016, at 7:17 PM, Duncan P. N. Exon Smith via cfe-commits > wrote: >> >> Any other ideas for improving the failure mode? > > Here’s a suggestion: > > https://github.com/llvm-mirror/libcxx/blob/master/include/vector#L1658 > > M

Re: [PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Howard Hinnant via cfe-commits
On Feb 9, 2016, at 7:17 PM, Duncan P. N. Exon Smith via cfe-commits wrote: > > Any other ideas for improving the failure mode? Here’s a suggestion: https://github.com/llvm-mirror/libcxx/blob/master/include/vector#L1658 Make this easy to activate. Howard _

Re: [PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Duncan P. N. Exon Smith via cfe-commits
Ah, so the cost isn't necessarily the same. I don't think this is worth it then. (Although, paradoxically, it opens up an avenue for testing, via a custom allocator which counts On 2016-Feb-09, at 16:14, Marshall Clow wrote: > > mclow.lists added a comment. > >> Since `__new_last` and `__end_

Re: [PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Duncan P. N. Exon Smith via cfe-commits
dexonsmith added a comment. Ah, so the cost isn't necessarily the same. I don't think this is worth it then. (Although, paradoxically, it opens up an avenue for testing, via a custom allocator which counts http://reviews.llvm.org/D17053 ___ cfe-comm

Re: [PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Marshall Clow via cfe-commits
mclow.lists added a comment. > Since `__new_last` and `__end_` are raw pointers, < should be the same cost > as !=. `pointer` is an alias for `allocator_traits<_Alloc>::pointer`, which might not be a raw pointer. http://reviews.llvm.org/D17053 _

Re: [PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Duncan P. N. Exon Smith via cfe-commits
dexonsmith added a subscriber: dexonsmith. dexonsmith added a comment. I'm not sure I disagree. What got me slightly motivated was seeing that UBSan doesn't catch this. http://reviews.llvm.org/D17053 ___ cfe-commits mailing list cfe-commits@lists.l

Re: [PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Duncan P. N. Exon Smith via cfe-commits
I'm not sure I disagree. What got me slightly motivated was seeing that UBSan doesn't catch this. > On 2016-Feb-09, at 16:04, Marshall Clow wrote: > > mclow.lists added a comment. > > Undefined behavior is just that, undefined. > > I'm not that interested in "fixing" this; I don't think it's

Re: [PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Marshall Clow via cfe-commits
mclow.lists added a comment. Undefined behavior is just that, undefined. I'm not that interested in "fixing" this; I don't think it's broken. http://reviews.llvm.org/D17053 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.o

[PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode

2016-02-09 Thread Duncan P. N. Exon Smith via cfe-commits
dexonsmith created this revision. dexonsmith added reviewers: mclow.lists, EricWF. dexonsmith added a subscriber: cfe-commits. The following program is obviously broken: #include int main(int argc, const char * argv[]) { std::vector v; v.push_back(0); v.pop_back()