<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[More than one character in single quotes?]]></title><description><![CDATA[<p>I accidentally printed more than one character in single quotes:</p>
<pre><code class="language-cpp">std::cout &lt;&lt; 'abc' &lt;&lt; std::endl; //Output: 6382179
</code></pre>
<p>What that mean?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/223616/more-than-one-character-in-single-quotes</link><generator>RSS for Node</generator><lastBuildDate>Sat, 03 Oct 2026 19:19:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/223616.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 28 Sep 2008 17:52:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to More than one character in single quotes? on Sun, 28 Sep 2008 17:52:59 GMT]]></title><description><![CDATA[<p>I accidentally printed more than one character in single quotes:</p>
<pre><code class="language-cpp">std::cout &lt;&lt; 'abc' &lt;&lt; std::endl; //Output: 6382179
</code></pre>
<p>What that mean?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1589792</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1589792</guid><dc:creator><![CDATA[SAn]]></dc:creator><pubDate>Sun, 28 Sep 2008 17:52:59 GMT</pubDate></item><item><title><![CDATA[Reply to More than one character in single quotes? on Sun, 28 Sep 2008 18:09:46 GMT]]></title><description><![CDATA[<p><a href="http://www.torsten-horn.de/techdocs/ascii.htm" rel="nofollow">http://www.torsten-horn.de/techdocs/ascii.htm</a><br />
=&gt;<br />
0x61 0x62 0x63<br />
=&gt;<br />
6382179<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>edit: One situation comes in my mind where it could be useful: When you want to read a bmp-file's header, the bmp-file must always start with 'BM'. So you can read the first two bytes of the file into a &quot;short&quot;-variable and compare it to 'BM' <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> (Not a very realistic situation though, since there are lots of libraries loading bmp-files but nonetheless...)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1589800</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1589800</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sun, 28 Sep 2008 18:09:46 GMT</pubDate></item><item><title><![CDATA[Reply to More than one character in single quotes? on Sun, 28 Sep 2008 18:08:07 GMT]]></title><description><![CDATA[<p>Why no compile error?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1589804</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1589804</guid><dc:creator><![CDATA[C++???]]></dc:creator><pubDate>Sun, 28 Sep 2008 18:08:07 GMT</pubDate></item><item><title><![CDATA[Reply to More than one character in single quotes? on Sun, 28 Sep 2008 18:10:22 GMT]]></title><description><![CDATA[<p>C++??? schrieb:</p>
<blockquote>
<p>Why no compile error?</p>
</blockquote>
<p>Because it's valid C++ :p</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1589807</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1589807</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sun, 28 Sep 2008 18:10:22 GMT</pubDate></item><item><title><![CDATA[Reply to More than one character in single quotes? on Sun, 28 Sep 2008 18:11:43 GMT]]></title><description><![CDATA[<p>Does it make any sence? who needs this?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1589809</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1589809</guid><dc:creator><![CDATA[C++???]]></dc:creator><pubDate>Sun, 28 Sep 2008 18:11:43 GMT</pubDate></item><item><title><![CDATA[Reply to More than one character in single quotes? on Sun, 28 Sep 2008 18:27:30 GMT]]></title><description><![CDATA[<p>C++??? schrieb:</p>
<blockquote>
<p>Does it make any sence? who needs this?</p>
</blockquote>
<p>For example, for micro-optimizations in some special cases:</p>
<pre><code class="language-cpp">bool isGetOrSet( const char* s )
{
    const unsigned int val = *reinterpret_cast&lt;unsigned int*&gt;( s );
    return val=='get\0' || val=='set\0';
}

...
bool yeah_its_valid = isGetOrSet( &quot;set&quot; );
</code></pre>
<p>edit: Ups, endianess, write '\0teg' and '\0tes'.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1589818</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1589818</guid><dc:creator><![CDATA[Badestrand]]></dc:creator><pubDate>Sun, 28 Sep 2008 18:27:30 GMT</pubDate></item></channel></rss>