<?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[bool in Serialize]]></title><description><![CDATA[<p>Hallo Leute!<br />
Hab Problem bei Speicherung bool Variable, kommt sowas als Fehler<br />
error C2679: binary '&gt;&gt;' : no operator defined which takes a right-hand operand of type 'bool' (or there is no acceptable conversion)</p>
<p>Hier Code:</p>
<pre><code class="language-cpp">void MyClasse::Serialize(CArchive &amp;ar)
{
    CObject::Serialize(ar);
    if (ar.IsStoring())
    {
    ar&lt;&lt;rect&lt;&lt;test;;//test ist bool
    }
    else
    {
    ar&gt;&gt;rect&gt;&gt;test;//test ist bool
    }
</code></pre>
<p>Darf bool nicht gespeichert werden?... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Soll bool vielleicht in int oder in DWORD oder sonst noch was umgewandelt werden...<br />
Es wäre aber praktisch direkt bool zu speichern...<br />
Was soll ich tun...</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/5707/bool-in-serialize</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 08:12:34 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/5707.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 May 2003 09:48:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to bool in Serialize on Wed, 07 May 2003 09:48:00 GMT]]></title><description><![CDATA[<p>Hallo Leute!<br />
Hab Problem bei Speicherung bool Variable, kommt sowas als Fehler<br />
error C2679: binary '&gt;&gt;' : no operator defined which takes a right-hand operand of type 'bool' (or there is no acceptable conversion)</p>
<p>Hier Code:</p>
<pre><code class="language-cpp">void MyClasse::Serialize(CArchive &amp;ar)
{
    CObject::Serialize(ar);
    if (ar.IsStoring())
    {
    ar&lt;&lt;rect&lt;&lt;test;;//test ist bool
    }
    else
    {
    ar&gt;&gt;rect&gt;&gt;test;//test ist bool
    }
</code></pre>
<p>Darf bool nicht gespeichert werden?... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Soll bool vielleicht in int oder in DWORD oder sonst noch was umgewandelt werden...<br />
Es wäre aber praktisch direkt bool zu speichern...<br />
Was soll ich tun...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27758</guid><dc:creator><![CDATA[Nick]]></dc:creator><pubDate>Wed, 07 May 2003 09:48:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Wed, 07 May 2003 10:29:00 GMT]]></title><description><![CDATA[<p>bool oder BOOL? Wenn ich BOOL nehme, dann klappt das, ohne Probleme ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27759</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27759</guid><dc:creator><![CDATA[Shaggy]]></dc:creator><pubDate>Wed, 07 May 2003 10:29:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Wed, 07 May 2003 10:48:00 GMT]]></title><description><![CDATA[<p>Die Archivierung klappt nicht mit bit. Da solltest du einen anderen Datentyp nehmen. short int klappt auf jeden Fall.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27760</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27760</guid><dc:creator><![CDATA[Roland]]></dc:creator><pubDate>Wed, 07 May 2003 10:48:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Wed, 07 May 2003 12:22:00 GMT]]></title><description><![CDATA[<p>sizeof(bool) == 1<br />
-&gt;<br />
ar&lt;&lt;rect&lt;&lt;(BYTE)test;//test ist bool</p>
<p>dürfte klappen!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27761</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27761</guid><dc:creator><![CDATA[RenéG]]></dc:creator><pubDate>Wed, 07 May 2003 12:22:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Wed, 07 May 2003 14:56:00 GMT]]></title><description><![CDATA[<blockquote>
<p>Original erstellt von &lt;Roland&gt;:<br />
<strong>Die Archivierung klappt nicht mit bit.</strong></p>
</blockquote>
<p>Blöd nur, dass bool 1 Byte hat <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /> .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27762</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27762</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Wed, 07 May 2003 14:56:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Wed, 07 May 2003 14:57:00 GMT]]></title><description><![CDATA[<blockquote>
<p>Original erstellt von Shaggy:<br />
<strong>bool oder BOOL? Wenn ich BOOL nehme, dann klappt das, ohne Probleme ...</strong></p>
</blockquote>
<p>bool ist ein eigener Datentyp. BOOL dagegen ist nur ein typedef auf ein int.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/27763</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27763</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Wed, 07 May 2003 14:57:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Thu, 08 May 2003 10:05:00 GMT]]></title><description><![CDATA[<p>Es mag ja sein, daß bool genau ein Byte entspricht, wird aber vom Compiler nie so behandelt. Der Compiler spricht genau ein Bit des Bytes an.</p>
<p>Roland</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27764</guid><dc:creator><![CDATA[Roland]]></dc:creator><pubDate>Thu, 08 May 2003 10:05:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Thu, 08 May 2003 10:37:00 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/2900">@Roland</a></p>
<p>Und was hat das mit dem Thema zu tun? Ist doch egal, wie der Compiler bool behandelt, wenn es mir möglich ist, bool als BYTE zu abstrahieren und damit zu serialisieren!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27765</guid><dc:creator><![CDATA[RenéG]]></dc:creator><pubDate>Thu, 08 May 2003 10:37:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Thu, 08 May 2003 10:54:00 GMT]]></title><description><![CDATA[<p>Ich habe eigentlich nur MaSTaH geantwortet. Immerhin hat er mich zitiert und anschliessend eine aus Compilersicht definitive falsche Antwort geliefert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27766</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27766</guid><dc:creator><![CDATA[Roland]]></dc:creator><pubDate>Thu, 08 May 2003 10:54:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Thu, 08 May 2003 11:10:00 GMT]]></title><description><![CDATA[<blockquote>
<p>Original erstellt von &lt;Roland&gt;:<br />
<strong>Immerhin hat er mich zitiert und anschliessend eine aus Compilersicht definitive falsche Antwort geliefert.</strong></p>
</blockquote>
<p>Der Compiler spricht überhaupt nix an, wenn dann der Prozessor. Ist klar, dass der nur ein Bit umsetzt wenn der aus ner 1 ne 0 macht und umgekehrt. sizeof(bool) ergibt bei mir aber immernoch 1.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27767</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27767</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Thu, 08 May 2003 11:10:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Thu, 08 May 2003 11:20:00 GMT]]></title><description><![CDATA[<p>Schau dir Disassemblierung an. Schau dir die Complilermeldung an wenn du versuchst eine grössere Zahl in eine bool Variable zu stellen.</p>
<p>Und wie du darauf kommst, daß der Prozessor dafür verantwortlich wäre, wie ein typischer Programmiersprachen-Datentyp behandelt wird verstehe ich überhaupt nicht.</p>
<p>Vielleicht sprechen wie auch aneinander vorbei, und darum sollten wir es hier jetzt einmal lassen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27768</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27768</guid><dc:creator><![CDATA[Roland]]></dc:creator><pubDate>Thu, 08 May 2003 11:20:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Thu, 08 May 2003 11:34:00 GMT]]></title><description><![CDATA[<blockquote>
<p>Original erstellt von &lt;Roland&gt;:<br />
<strong>Vielleicht sprechen wie auch aneinander vorbei...</strong></p>
</blockquote>
<p>Kann gut sein <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/27769</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27769</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Thu, 08 May 2003 11:34:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Thu, 08 May 2003 11:37:00 GMT]]></title><description><![CDATA[<p>Schade, dabei wurde es gerade spannend ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27770</guid><dc:creator><![CDATA[Shaggy]]></dc:creator><pubDate>Thu, 08 May 2003 11:37:00 GMT</pubDate></item><item><title><![CDATA[Reply to bool in Serialize on Thu, 08 May 2003 12:06:00 GMT]]></title><description><![CDATA[<blockquote>
<p>Original erstellt von &lt;Roland&gt;:<br />
<strong>Und wie du darauf kommst, daß der Prozessor dafür verantwortlich wäre, wie ein typischer Programmiersprachen-Datentyp behandelt wird verstehe ich überhaupt nicht.</strong></p>
</blockquote>
<p>1.) Das habe ich auch garnicht gesagt. Zitier mich bitte richtig.</p>
<p>2.) Weil ein Compiler keine alloziierte Variable ansprechen kann. Les doch mal bitte deinen Post in dem steht: &quot;Der Compiler spricht genau ein Bit des Bytes an.&quot;. Der Compiler setzt keine Bits, wenn dann der Prozessor.</p>
<p>EDIT: bool kennt nur true oder false. Dennoch belegt ein bool 1 Byte, auch beim speichern. Du hast oben gesagt serialize funktioniere nicht mit bit, was schlicht und ergreifend unpassend ist, da bool ein byte belegt. CArchive hat den &lt;&lt; bzw. &gt;&gt; Operator nur nicht explizit für bool überladen. Deshalb muss man auf BYTE casten wie RenéG gesagt hat.</p>
<p>[ Dieser Beitrag wurde am 08.05.2003 um 14:14 Uhr von <strong>MaSTaH</strong> editiert. ]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/27771</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/27771</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Thu, 08 May 2003 12:06:00 GMT</pubDate></item></channel></rss>