<?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 ?]]></title><description><![CDATA[<p>Hi!<br />
Ich weiß dass ist wohl eine totale Anfängerfrage aber ich stehe gerade auf der Leitung...(liegt wohl am Schlafmangel^^)<br />
Ich habe für bool-angaben bisher immer FALSE oder TRUE verwendet. Also in Großbuchstaben...</p>
<p>Was auch immer funktioniert hat. Damals in der Schule und dann auch auf meinem Rechner...ABER ich hatte für meine Projekte außerhalb der Schulaufgaben (weil ich eigene Fenster erzeugt habe) bisher immer die &quot;windows.h&quot; in meinem code und hab die einfach mal für eine Konsolenanwendung weggelassen...(!)...<br />
Und plötzlich bekomm ich vom Compiler das:</p>
<pre><code>error C2065: 'FALSE' : nichtdeklarierter Bezeichner
error C2065: 'TRUE' : nichtdeklarierter Bezeichner
</code></pre>
<p>Ich steh gerade ziemlich auf der Leitung...<br />
wenn ich &lt;windows.h&gt; einbinde funzt alles...<br />
Wenn ich allerdings &quot;true&quot; und &quot;false&quot; verwende und die stdio.h einbinde funktioniert es auch...(auch ohne windows.h)<br />
aber bei TRUE und FALSE + &lt;stdio.h&gt; bekomm ich die errors...</p>
<p>Ich kann mich aber erinnern dass wir früher in der Schule &lt;windows.h&gt; nicht verwenden durften (da hat mein Prof immer gemeckert es sei unnötig...aber ich hab die MessageBox immer für Fehlermeldungen verwendet *g*)und trotzdem TRUE und FALSE verwendet haben...-&gt;und es gab keine Probleme...<br />
und plötzlich meckert mein MSVC herum...<br />
Wisst ihr wieso?</p>
<p>MfG Kuldren</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/163020/bool</link><generator>RSS for Node</generator><lastBuildDate>Sat, 12 Sep 2026 21:38:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/163020.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 25 Oct 2006 10:32:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 10:34:24 GMT]]></title><description><![CDATA[<p>Hi!<br />
Ich weiß dass ist wohl eine totale Anfängerfrage aber ich stehe gerade auf der Leitung...(liegt wohl am Schlafmangel^^)<br />
Ich habe für bool-angaben bisher immer FALSE oder TRUE verwendet. Also in Großbuchstaben...</p>
<p>Was auch immer funktioniert hat. Damals in der Schule und dann auch auf meinem Rechner...ABER ich hatte für meine Projekte außerhalb der Schulaufgaben (weil ich eigene Fenster erzeugt habe) bisher immer die &quot;windows.h&quot; in meinem code und hab die einfach mal für eine Konsolenanwendung weggelassen...(!)...<br />
Und plötzlich bekomm ich vom Compiler das:</p>
<pre><code>error C2065: 'FALSE' : nichtdeklarierter Bezeichner
error C2065: 'TRUE' : nichtdeklarierter Bezeichner
</code></pre>
<p>Ich steh gerade ziemlich auf der Leitung...<br />
wenn ich &lt;windows.h&gt; einbinde funzt alles...<br />
Wenn ich allerdings &quot;true&quot; und &quot;false&quot; verwende und die stdio.h einbinde funktioniert es auch...(auch ohne windows.h)<br />
aber bei TRUE und FALSE + &lt;stdio.h&gt; bekomm ich die errors...</p>
<p>Ich kann mich aber erinnern dass wir früher in der Schule &lt;windows.h&gt; nicht verwenden durften (da hat mein Prof immer gemeckert es sei unnötig...aber ich hab die MessageBox immer für Fehlermeldungen verwendet *g*)und trotzdem TRUE und FALSE verwendet haben...-&gt;und es gab keine Probleme...<br />
und plötzlich meckert mein MSVC herum...<br />
Wisst ihr wieso?</p>
<p>MfG Kuldren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160888</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160888</guid><dc:creator><![CDATA[Kuldren]]></dc:creator><pubDate>Wed, 25 Oct 2006 10:34:24 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 10:35:45 GMT]]></title><description><![CDATA[<p>weil TRUE und FALSE in der windows.h definiert sind und nicht zu C++ gehören.</p>
<p>Nimm einfach das kleingeschriebene, das braucht in C++ keinen Header und dein Editor sollte es auch bunt machen.</p>
<p>(in C muss man aber stdbool.h einbinden)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160890</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160890</guid><dc:creator><![CDATA[DrGreenthumb]]></dc:creator><pubDate>Wed, 25 Oct 2006 10:35:45 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 10:40:42 GMT]]></title><description><![CDATA[<blockquote>
<p>weil TRUE und FALSE in der windows.h definiert sind und nicht zu C++ gehören.</p>
<p>Nimm einfach das kleingeschriebene, das braucht in C++ keinen Header und dein Editor sollte es auch bunt machen.</p>
<p>(in C muss man aber stdbool.h einbinden)</p>
</blockquote>
<p>Das hab ich mir auch gedacht...<br />
Aber in der Schule hat es ohne irgendwelche besonderne Header mit FALSE und TRUE funktioniert...deshalb war ich grad ein wenig verwirrt..<br />
Trotzdem danke für die Info!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160894</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160894</guid><dc:creator><![CDATA[Kuldren]]></dc:creator><pubDate>Wed, 25 Oct 2006 10:40:42 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 10:42:47 GMT]]></title><description><![CDATA[<p>welchen compiler hattet ihr denn in der schwule?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160895</guid><dc:creator><![CDATA[anfrage]]></dc:creator><pubDate>Wed, 25 Oct 2006 10:42:47 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 10:43:41 GMT]]></title><description><![CDATA[<blockquote>
<p>welchen compiler hattet ihr denn in der schule?</p>
</blockquote>
<p>MSVC 6.0</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160896</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160896</guid><dc:creator><![CDATA[Kuldren]]></dc:creator><pubDate>Wed, 25 Oct 2006 10:43:41 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 11:18:48 GMT]]></title><description><![CDATA[<p>nimm einfach true und false. Das zufällig irgend wo in irgend einem Header von irgend einem prehistorischen C- oder C++-Code FALSE/TRUE definiert sind, sollte man der portabilität und Ästhetik zu liebe einfach ignorieren.</p>
<p>Hier noch mal: FALSE/TRUE sind nicht Standard konform und prehistorischer Ballast einiger C- oder C++-Frameworks</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160919</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160919</guid><dc:creator><![CDATA[ruediger@uni]]></dc:creator><pubDate>Wed, 25 Oct 2006 11:18:48 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 15:29:48 GMT]]></title><description><![CDATA[<p>Warum ärgerst du dich denn mit sowas rum?<br />
Schreib doch dann einfach</p>
<pre><code class="language-cpp">#ifndef TRUE
#define TRUE true
#endif
#ifndef FALSE
#define FALSE false
#endif
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1161109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161109</guid><dc:creator><![CDATA[Tobi3000]]></dc:creator><pubDate>Wed, 25 Oct 2006 15:29:48 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 15:37:39 GMT]]></title><description><![CDATA[<p>Hmm das ist doch schwachsin ... <a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/13521">@Tobi3000</a>... BOOL ist halt im Windowsheader als int definiert ... d.h. ist TRUE und FALSE als 1 und 0 definiert ... normal sollte man aber bool und true und false nutzen da nen int nen bissel mehr (4) Bits als nen bool (2) braucht ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161113</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161113</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Wed, 25 Oct 2006 15:37:39 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 15:42:02 GMT]]></title><description><![CDATA[<p>(D)Evil schrieb:</p>
<blockquote>
<p>da nen int nen bissel mehr (4) Bits als nen bool (2) braucht ...</p>
</blockquote>
<p>Whoa?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161115</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161115</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Wed, 25 Oct 2006 15:42:02 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 18:34:23 GMT]]></title><description><![CDATA[<p>Wenn man lieber TRUE als true benutzt,ist es doch eine gute Alternative.</p>
<p>Und bool ist nur ein Byte groß. <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>
<p>EDIT: Ach du hast Bits geschrieben.</p>
<p>hmm ich glaub int ist aber 4 Bytes groß und bool 1 Byte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161277</guid><dc:creator><![CDATA[Tobi3000]]></dc:creator><pubDate>Wed, 25 Oct 2006 18:34:23 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 18:45:23 GMT]]></title><description><![CDATA[<p>Tobi3000 schrieb:</p>
<blockquote>
<p>Wenn man lieber TRUE als true benutzt,ist es doch eine gute Alternative.</p>
</blockquote>
<p>Nein, ist es nicht, denn damit verwendet man was, was nicht durch den Standard abgedeckt wird, obwohl man nicht muss. Außerdem ist es blöder zu schreiben.</p>
<p>Zum Anderen schreib ich mal lieber nix^^ <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161310</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161310</guid><dc:creator><![CDATA[GPC]]></dc:creator><pubDate>Wed, 25 Oct 2006 18:45:23 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 18:54:10 GMT]]></title><description><![CDATA[<p>also bool hat 1 bit nämlich 1 oder 0.<br />
char hat 1 Byte nämlich 8 bits<br />
ein int hat 2 Byte nämlich 16 Bits...<br />
und ein float hat 4Byte nämlich 32 Bits<br />
und ein double hat 8 byte. Nämlich 64 Bits...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161329</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161329</guid><dc:creator><![CDATA[Sqwan]]></dc:creator><pubDate>Wed, 25 Oct 2006 18:54:10 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 18:58:33 GMT]]></title><description><![CDATA[<p>bool hat 1 BYTE.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161337</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161337</guid><dc:creator><![CDATA[falsch gedacht]]></dc:creator><pubDate>Wed, 25 Oct 2006 18:58:33 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 19:11:19 GMT]]></title><description><![CDATA[<p>Sqwan schrieb:</p>
<blockquote>
<p>also bool hat 1 bit nämlich 1 oder 0.<br />
char hat 1 Byte nämlich 8 bits<br />
ein int hat 2 Byte nämlich 16 Bits...<br />
und ein float hat 4Byte nämlich 32 Bits<br />
und ein double hat 8 byte. Nämlich 64 Bits...</p>
</blockquote>
<p>und auf einem anderen system. zB heutigen 32 bit x86er systemen sieht es komplett anders aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161367</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161367</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Wed, 25 Oct 2006 19:11:19 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 19:13:41 GMT]]></title><description><![CDATA[<p>In C++ ist alles was addressierbar ist mindestens 1 Byte gross, daher auch bool. Und da jedes Byte in C++ per definitionem immer &gt;= 8 Bitse haben muss ist das Verschwändung. Mir aber komplett Wurst <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="🙂"
    /><br />
Das &quot;BOOL&quot; von &lt;windows.h&gt; ist im übrigen ein typedef auf int, und auf &quot;normalen&quot; Maschinen daher 4 Byte gross.</p>
<p>C++ erzwingt aber beim Schreiben dass in einem &quot;bool&quot; immer nur 0 oder 1 drinnen stehen kann (was auf BOOL ja nicht zutrifft). Solange man also nicht Pointer/Referenzen rumcastet und sich &quot;deppert spielt&quot; kann man davon ausgehen dass Tests wie &quot;if(b == true)&quot; sicher sind (was wieder auf BOOL nicht zutrifft).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161375</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161375</guid><dc:creator><![CDATA[Plotzenhotz]]></dc:creator><pubDate>Wed, 25 Oct 2006 19:13:41 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 19:57:08 GMT]]></title><description><![CDATA[<p>Plotzenhotz: Der C++-Standard sagt überhaupt nix über die Byte-Größe.</p>
<p>So, und nun die Lösung zu eurem Streitthema: Die Größe von bool hängt vom Zusammenhang und vielleicht sogar der Implementation ab :p</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161456</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161456</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Wed, 25 Oct 2006 19:57:08 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 20:12:59 GMT]]></title><description><![CDATA[<p>Michael E. schrieb:</p>
<blockquote>
<p>Plotzenhotz: Der C++-Standard sagt überhaupt nix über die Byte-Größe.</p>
</blockquote>
<p>Traurig aber wahr...<br />
Da wird immer über portablen Code gesprochen und dann kann man sich nichtmal darauf verlassen dass die Datentypen auf allen Systemen den gleichen Wertebereich abdecken.</p>
<p>Gruß Spacelord</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161471</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161471</guid><dc:creator><![CDATA[Spacelord]]></dc:creator><pubDate>Wed, 25 Oct 2006 20:12:59 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 20:19:50 GMT]]></title><description><![CDATA[<p>Spacelord schrieb:</p>
<blockquote>
<p>Michael E. schrieb:</p>
<blockquote>
<p>Plotzenhotz: Der C++-Standard sagt überhaupt nix über die Byte-Größe.</p>
</blockquote>
<p>Traurig aber wahr...<br />
Da wird immer über portablen Code gesprochen und dann kann man sich nichtmal darauf verlassen dass die Datentypen auf allen Systemen den gleichen Wertebereich abdecken.</p>
</blockquote>
<p>Gerade deshalb ist C++ auch auf so unterschiedlichen Systemen einsetzbar! Ne kleine Zusatzarbeit für den Programmierer ist es allerdings <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161481</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161481</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Wed, 25 Oct 2006 20:19:50 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 20:38:23 GMT]]></title><description><![CDATA[<p>Äh.<br />
Blubb.<br />
Bin mir ziemlich sicher dass im C++ Standard (sinngemäss) steht dass ein Byte &gt;= 8 Bit haben muss, die kleinste adressierbare Einheit der Maschine darstellt, und dass &quot;char&quot; genau ein solches Byte belegt.</p>
<p>Steht dahier im übrigen auch so:<br />
<a href="http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.5" rel="nofollow">http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.5</a></p>
<p>Das bedeutet natürlich nicht dass das &quot;echte&quot; Byte der Maschine nicht &lt; 8 Bit haben kann, bloss muss die C++ Implementierung das dann so &quot;verstecken&quot; dass das &quot;C++ Byte&quot; eben trotzdem wieder &gt;= 8 Bit hat.</p>
<p>Ich hab den Standard-Text leider nicht, sonst würde ich nachsehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161494</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161494</guid><dc:creator><![CDATA[Plotzenhotz]]></dc:creator><pubDate>Wed, 25 Oct 2006 20:38:23 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 20:49:36 GMT]]></title><description><![CDATA[<p>Also laut meinem Buch hat bool 1 Byte, genau wie char...<br />
deshalb auch oft die Bitte &quot;bool: Bitte ein bit&quot;...*g*</p>
<blockquote>
<p>Typ Byte<br />
bool 1<br />
char 1<br />
short 2<br />
int 4<br />
float 4<br />
double 8</p>
</blockquote>
<p>Ich werde jetzt nur mehr true und false verwenden ohne typedef/define...<br />
Im Nachhinein betrachtet: Echt seltsam dass in irgendeinem uralten Header<br />
TRUE und FALSE definiert sind...Egal...<br />
Ich will mich nicht auf Zufälligkeiten verlassen müssen...<br />
Danke nochmal...stand echt auf der Leitung..*g*</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161497</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161497</guid><dc:creator><![CDATA[Kuldren]]></dc:creator><pubDate>Wed, 25 Oct 2006 20:49:36 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 21:00:26 GMT]]></title><description><![CDATA[<p>Plotzenhotz schrieb:</p>
<blockquote>
<p>Äh.<br />
Blubb.<br />
Bin mir ziemlich sicher dass im C++ Standard (sinngemäss) steht dass ein Byte &gt;= 8 Bit haben muss, die kleinste adressierbare Einheit der Maschine darstellt, und dass &quot;char&quot; genau ein solches Byte belegt.</p>
<p>Steht dahier im übrigen auch so:<br />
<a href="http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.5" rel="nofollow">http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.5</a></p>
</blockquote>
<p>Dann ist das wieder so eine von C geerbte Garantie (wie zum Beispiel auch die Mindestgröße von int).</p>
<p>Kuldren schrieb:</p>
<blockquote>
<p>Im Nachhinein betrachtet: Echt seltsam dass in irgendeinem uralten Header<br />
TRUE und FALSE definiert sind...</p>
</blockquote>
<p>Nö, bool ist eben erst sehr spät als Built-in in die Sprache reingekommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161504</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Wed, 25 Oct 2006 21:00:26 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Wed, 25 Oct 2006 21:30:59 GMT]]></title><description><![CDATA[<p>Ich hab vom Standard nur nen Draft von 96.</p>
<blockquote>
<p>3.9.1 Fundamental types [basic.fundamental]<br />
1 Objects declared as characters (char) shall be large enough to store any member of the implementation’s<br />
basic character set. If a character from this set is stored in a character object, the integral value of that character<br />
object is equal to the value of the single character literal form of that character. It is implementationdefined<br />
whether a char object can hold negative values. Characters can be explicitly declared unsigned<br />
or signed. Plain char, signed char, and unsigned char are three distinct types. A char, a<br />
signed char, and an unsigned char occupy the same amount of storage and have the same alignment<br />
requirements (3.9); that is, they have the same object representation. For character types, all bits of<br />
the object representation participate in the value representation. For unsigned character types, all possible<br />
bit patterns of the value representation represent numbers. These requirements do not hold for other types.<br />
In any particular implementation, a plain char object can take on either the same values as a<br />
signed char or an unsigned char; which one is implementationdefined.</p>
<p>2 There are four signed integer types: “signed char”, “short int”, “int”, and “long int.” In this<br />
list, each type provides at least as much storage as those preceding it in the list. Plain ints have the natural<br />
size suggested by the architecture of the execution environment37) ; the other signed integer types are<br />
provided to meet special needs.<br />
__________________<br />
37) that is, large enough to contain any value in the range of INT_MIN and INT_MAX, as defined in the header &lt;climits&gt;.</p>
<p>3– 32 Basic concepts DRAFT: 2 December 1996 3.9.1 Fundamental types</p>
<p>3 For each of the signed integer types, there exists a corresponding (but different) unsigned integer type:<br />
“unsigned char”, “unsigned short int”, “unsigned int”, and “unsigned long<br />
int,” each of which occupies the same amount of storage and has the same alignment requirements (3.9)<br />
as the corresponding signed integer type38) ; that is, each signed integer type has the same object representation<br />
as its corresponding unsigned integer type. The range of nonnegative values of a signed integer type<br />
is a subrange of the corresponding unsigned integer type, and the value representation of each corresponding<br />
signed/unsigned type shall be the same.</p>
<p>4 Unsigned integers, declared unsigned, shall obey the laws of arithmetic modulo 2n where n is the number<br />
of bits in the value representation of that particular size of integer.39)</p>
<p>5 Type wchar_t is a distinct type whose values can represent distinct codes for all members of the largest<br />
extended character set specified among the supported locales (22.1.1). Type wchar_t shall have the same<br />
size, signedness, and alignment requirements (1.6) as one of the other integral types, called its underlying<br />
type.</p>
<p>6 Values of type bool are either true or false.40) [Note: there are no signed, unsigned, short, or<br />
long bool types or values. ] As described below, bool values behave as integral types. Values of type<br />
bool participate in integral promotions (4.5).</p>
<p>7 Types bool, char, wchar_t, and the signed and unsigned integer types are collectively called integral<br />
types.41) A synonym for integral type is integer type. The representations of integral types shall define values<br />
by use of a pure binary numeration system.42) [Example: this International Standard permits 2’s complement,<br />
1’s complement and signed magnitude representations for integral types. ]</p>
<p>8 There are three floating point types: float, double, and long double. The type double provides<br />
at least as much precision as float, and the type long double provides at least as much precision as<br />
double. The set of values of the type float is a subset of the set of values of the type double; the set<br />
of values of the type double is a subset of the set of values of the type long double. The value representation<br />
of floatingpoint<br />
types is implementationdefined.<br />
Integral and floating types are collectively<br />
called arithmetic types. Specializations of the standard template numeric_limits (18.2) shall specify<br />
the maximum and minimum values of each arithmetic type for an implementation.</p>
<p>9 The void type has an empty set of values. The void type is an incomplete type that cannot be completed.<br />
It is used as the return type for functions that do not return a value. Any expression can be explicitly converted<br />
to type cv void (5.4). An expression of type void shall be used only as an expression statement<br />
(6.2), as an operand of a comma expression (5.18), or as a second or third operand of ?: (5.16).</p>
<p>10 [Note: even if the implementation defines two or more basic types to have the same value representation,<br />
they are nevertheless different types. ]</p>
</blockquote>
<p>Zumindest da kann ich nirgendwo irgendwelche Garantien bezüglich Bytes und Bits entdecken.</p>
<p>Gruß Spacelord</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161518</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161518</guid><dc:creator><![CDATA[Spacelord]]></dc:creator><pubDate>Wed, 25 Oct 2006 21:30:59 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Thu, 26 Oct 2006 01:22:47 GMT]]></title><description><![CDATA[<p>OK, hab jetzt nachgesehen, im Standard ist (für mich) nix zu finden was auf 8 Bit schliessen lässt. Ich vermute mal es ist aber vernünftig vorauszusetzen dass immer char &gt;= 8 Bit, short &amp; int &gt;= 16 Bit und long &gt;= 32 Bit. Auf diversen &quot;exotischen&quot; Plattformen die vielleicht ein native 7-Bit word haben wird man wohl eher nen C-Compiler antreffen als nen C++-Compiler, von daher denke ich kann man diese ignorieren <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>Wie schön und einfach ist dagegen Java was das Thema angeht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161545</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161545</guid><dc:creator><![CDATA[Plotzenhotz]]></dc:creator><pubDate>Thu, 26 Oct 2006 01:22:47 GMT</pubDate></item><item><title><![CDATA[Reply to bool ? on Thu, 26 Oct 2006 15:54:02 GMT]]></title><description><![CDATA[<p>Kuldren schrieb:</p>
<blockquote>
<p>Also laut meinem Buch hat bool 1 Byte, genau wie char...</p>
</blockquote>
<p>Was char betrifft, ist das korrekt. Bei bool ist das allerdings nicht so. Der Standard legt lediglich fest, dass bool ein integraler Typ ist. Wenn ein Compiler also Lust hat, kann er bool intern auch auf long abbilden.</p>
<p>Kuldren schrieb:</p>
<blockquote>
<p>Ich werde jetzt nur mehr true und false verwenden ohne typedef/define...</p>
</blockquote>
<p>Um's kurz zu machen, das ist auf jeden Fall die richtige Entscheidung. Und mehr gibt's dazu eigentlich auch nicht zu sagen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1162034</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1162034</guid><dc:creator><![CDATA[groovemaster]]></dc:creator><pubDate>Thu, 26 Oct 2006 15:54:02 GMT</pubDate></item></channel></rss>