Re: Clang does not like constexpression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 14 Jun 2017, Jesse Williamson wrote:
> > 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.)

But nobody does that.  It's stuff like

	strlen("\r\nffffffffffffffff;chunk-signature=")

which can just be

	sizeof("whatever") - 1

and it is clear to the reader of the code that it isn't strlen and \0's in 
the string aren't relevant.

IOW I don't see why we would need a fully C-like constexpr strlen...

sage
--
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



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux