Similar questions have been asked about the data type of string literals in C++.
Many people have cited the standard:
A narrow string literal has type “array of n const char”, where n is the size of the string as defined below, and has static storage duration (3.7)
I've written the following statement in the main function:
char cstring[]= "hellohellohellohellohellohello";
But I can't find any string literal stored as static data in the assembly. In fact, the assembly shows that the string is decomposed and "stored" directly in the instructions.
movl $1819043176, -48(%rbp)
movl $1818585199, -44(%rbp)
movl $1701343084, -40(%rbp)
movl $1752132716, -36(%rbp)
movl $1869376613, -32(%rbp)
movl $1819043176, -28(%rbp)
movl $1818585199, -24(%rbp)
movw $28524, -20(%rbp)
movb $0, -18(%rbp)
While a similar statement in the global scope has as a result the string stored as static data.
char cstring1[] = "hellohellohellohellohellohello";
The assembly
cstring1:
.string "hellohellohellohellohellohello"
The above example is available online here.
So this seems not conform to the cited standard. Maybe there are some exceptions to what is cited here?