Does C++ allow 8 byte long multi-character literals? -
why allowed:
uint32_t x = 'name';
but gets truncated 32 bits:
uint64_t x = 'namename';
is there way have 8-byte long multicharacter literal?
yes, long compiler has 8-byte int
s , supports it.
the c++ standard farily terse regarding multi-character literals. has on matter (c++14, 2.14.3/1):
an ordinary character literal contains more 1 c-char multicharacter literal. multicharacter literal, or ordinary character literal containing single c-char not representable in execution character set, conditionally-supported, has type
int
, , has implementation-defined value.
(emphasis mine)
as see, pretty standard says if multicharacter literals supported (they don't have be), of type int
. value compiler.
Comments
Post a Comment