[libcxx-commits] [PATCH] D114395: [libc++] Fix the return value of max_size()
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 29 11:28:43 PST 2021
Quuxplusone added a comment.
FWIW, I'm still of the (very firmly held) opinion that this patch is unnecessary. `max_size()` is //always// just an upper bound on the size of the sequence. Lowering that upper bound
- might introduce actual factual errors, e.g. if we get the bound wrong — whereas `size_t(-1)` can never be wrong
- will never help any user of libc++, because a loose upper bound (as returned by `max_size`) is never useful and always useless
- is no closer to being "accurate," because it is just as impossible //in practice// to have a `string_view` of length 9223372036854775807 or 4611686018427387903, as to have a `string_view` of length 18446744073709551615. These are all equally lying numbers, and there's no point pretending that any one of them is "more useful" or "more accurate" than any other.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114395/new/
https://reviews.llvm.org/D114395
More information about the libcxx-commits
mailing list