What is the data type of a string literal in C++?
<p>Similar questions have been asked about the data type of string literals in C++.</p>

<p>Many people have cited the standard:</p>

<blockquote>
  <p>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)</p>
</blockquote>

<p>I've written the following statement in the main function:</p>

<pre><code>  char cstring[]= "hellohellohellohellohellohello";
</code></pre>

<p>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.</p>

<pre><code>    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)
</code></pre>

<p>While a similar statement in the <strong>global scope</strong> has as a result the string stored as static data.</p>

<pre><code>char cstring1[] = "hellohellohellohellohellohello";
</code></pre>

<p>The assembly</p>

<pre><code>cstring1:
    .string "hellohellohellohellohellohello"
</code></pre>

<p>The above example is available online <a href="https://gcc.godbolt.org/#compilers:!((compiler:g447,options:&#39;+-O0&#39;,source:&#39;%23include%3Ciostream%3E%0A%23include%3Cstring%3E%0Ausing+namespace+std%3B%0A%0Achar+cstring1%5B%5D%3D+%22hellohellohellohellohellohello%22%3B%0A%0Aint+main()%7B%0A++char+cstring%5B%5D%3D+%22hellohellohellohellohellohello%22%3B%0A++cout%3C%3Ccstring%3B%0A++return+0%3B%0A%7D&#39;)),filterAsm:(colouriseAsm:!t,commentOnly:!t,directives:!t,labels:!t),version:3" rel="noreferrer">here</a>.</p>

<p>So this seems not conform to the cited standard. Maybe there are some exceptions to what is cited here?</p>