<?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[BOOST_STATIC_ASSERT Verhalten]]></title><description><![CDATA[<p>Hallo,</p>
<p>da ich eine Lösung suche, wie ich während des Kompilierens überprüfen kann, ob ein int eine Länge von 4 Bytes hat. Ich habe auch BOOST_STATIC_ASSERT gefunden und dabei ein merkwürdiges Verhalten gefunden.</p>
<p>Folgendes wird fehlerfrei kompiliert:</p>
<pre><code class="language-cpp">BOOST_STATIC_ASSERT(sizeof(int) == 4);
</code></pre>
<p>Folgendes erzeugt beim Mircosoft Visual 2005 Compiler die Fehlermeldung: error C2059: syntax error : )</p>
<pre><code class="language-cpp">BOOST_STATIC_ASSERT(sizeof int == 4);
</code></pre>
<p>Warum? sizeof ist doch ein Operator und man braucht das Argument nicht zu klammern?</p>
<p>Gruss Lars</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/251231/boost_static_assert-verhalten</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 14:31:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/251231.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 01 Oct 2009 10:28:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to BOOST_STATIC_ASSERT Verhalten on Thu, 01 Oct 2009 10:28:00 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>da ich eine Lösung suche, wie ich während des Kompilierens überprüfen kann, ob ein int eine Länge von 4 Bytes hat. Ich habe auch BOOST_STATIC_ASSERT gefunden und dabei ein merkwürdiges Verhalten gefunden.</p>
<p>Folgendes wird fehlerfrei kompiliert:</p>
<pre><code class="language-cpp">BOOST_STATIC_ASSERT(sizeof(int) == 4);
</code></pre>
<p>Folgendes erzeugt beim Mircosoft Visual 2005 Compiler die Fehlermeldung: error C2059: syntax error : )</p>
<pre><code class="language-cpp">BOOST_STATIC_ASSERT(sizeof int == 4);
</code></pre>
<p>Warum? sizeof ist doch ein Operator und man braucht das Argument nicht zu klammern?</p>
<p>Gruss Lars</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1786824</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1786824</guid><dc:creator><![CDATA[BoostTester]]></dc:creator><pubDate>Thu, 01 Oct 2009 10:28:00 GMT</pubDate></item><item><title><![CDATA[Reply to BOOST_STATIC_ASSERT Verhalten on Thu, 01 Oct 2009 10:30:18 GMT]]></title><description><![CDATA[<p>Doch, sizeof verlangt die Klammerung.</p>
<p>Edit: Halbwissenwarnung, zumindest finde ich es in keinem meiner Bücher anders.</p>
<p>MfG SideWinder</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1786826</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1786826</guid><dc:creator><![CDATA[SideWinder]]></dc:creator><pubDate>Thu, 01 Oct 2009 10:30:18 GMT</pubDate></item><item><title><![CDATA[Reply to BOOST_STATIC_ASSERT Verhalten on Thu, 01 Oct 2009 10:42:06 GMT]]></title><description><![CDATA[<p>Klammern sind nötig, wenn das Argument ein Typ ist, angewendet auf einen Ausdruck sind dagegen keine Klammern erforderlich.</p>
<blockquote>
<p>5.3.3/1<br />
The sizeof operator yields the number of bytes in the object representation of its operand. The operand is either an expression, which is not evaluated, or a <strong>parenthesized</strong> type-id.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1786829</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1786829</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Thu, 01 Oct 2009 10:42:06 GMT</pubDate></item><item><title><![CDATA[Reply to BOOST_STATIC_ASSERT Verhalten on Thu, 01 Oct 2009 12:44:51 GMT]]></title><description><![CDATA[<p>Hallo camper,</p>
<p>das erklärt es! Danke!</p>
<p>Gruss Lars</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1786889</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1786889</guid><dc:creator><![CDATA[BoostTester]]></dc:creator><pubDate>Thu, 01 Oct 2009 12:44:51 GMT</pubDate></item></channel></rss>