A
arnuld
i tried to output these 2 to the std. output:
const std::string hello = "Hello";
const std::string message = hello + ", world" + "!";
const std::string exclam = "!";
const std::string message2 = "hello" + " world" + exclam;
the first one runs fine but 2nd does not as we can not combine 2
string literals. i know that the "+" operator is left-associative,
hence:
/hello + ", world" + "!"/
means
/(hello + ",world") + "!"/
but what does /(hello + ", world")/ will produce:
a string literal
a character literal
or something else ?
const std::string hello = "Hello";
const std::string message = hello + ", world" + "!";
const std::string exclam = "!";
const std::string message2 = "hello" + " world" + exclam;
the first one runs fine but 2nd does not as we can not combine 2
string literals. i know that the "+" operator is left-associative,
hence:
/hello + ", world" + "!"/
means
/(hello + ",world") + "!"/
but what does /(hello + ", world")/ will produce:
a string literal
a character literal
or something else ?