On Wed, 14 Jun 2017, Sage Weil wrote:
It seems like that ambiguity would be explicitly communicated by using the originally proposed string_length() instead of a clever strlen()-lookalike.
Right, since we aren't talking about general handling of compile-time arrays.
size_t constexpr string_length(const char *s) { return 0 == *s ? 0 : 1 + string_length(1 + s); } ...won't compile if you try something like: constexpr auto l = string_length(nullptr);
Also... wouldn't sizeof("foo")-1 work just as well as string_length()?
constexpr char *s[] = { 'f', 'o', 'o', '\0', '\0' }; ...seems like it would still be a problem using sizeof(). (But, runtime strlen() and a constexpr string_length() would still return the same result.) -Jesse -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html