<?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[int auf 64 Bit]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich hätte eine kurze Frage: wenn ich ein<br />
Programm schreibe, z.B. solches:</p>
<pre><code>int main()
{
    int a = 3;
}
</code></pre>
<p>Und dieses Programm jetzt<br />
a) auf einer 32-Bit Architektur kompiliere und ausführe und<br />
b) auf einer 64-Bit Architektur kompiliere und ausführe</p>
<p>Werden ja im Fall a) 4 Byte im SPeicher für a angelegt und im Fall b) ?</p>
<p>Sind es jetzt da 64 Bit also 8 Byte?</p>
<p>Danke euch</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/310256/int-auf-64-bit</link><generator>RSS for Node</generator><lastBuildDate>Tue, 04 Aug 2026 17:34:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/310256.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Nov 2012 12:56:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 12:56:26 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich hätte eine kurze Frage: wenn ich ein<br />
Programm schreibe, z.B. solches:</p>
<pre><code>int main()
{
    int a = 3;
}
</code></pre>
<p>Und dieses Programm jetzt<br />
a) auf einer 32-Bit Architektur kompiliere und ausführe und<br />
b) auf einer 64-Bit Architektur kompiliere und ausführe</p>
<p>Werden ja im Fall a) 4 Byte im SPeicher für a angelegt und im Fall b) ?</p>
<p>Sind es jetzt da 64 Bit also 8 Byte?</p>
<p>Danke euch</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268532</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268532</guid><dc:creator><![CDATA[fragender2]]></dc:creator><pubDate>Wed, 07 Nov 2012 12:56:26 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 13:00:22 GMT]]></title><description><![CDATA[<p>Ne, auch 4 Byte:</p>
<p><a href="http://en.cppreference.com/w/cpp/language/types" rel="nofollow">http://en.cppreference.com/w/cpp/language/types</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268535</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268535</guid><dc:creator><![CDATA[out]]></dc:creator><pubDate>Wed, 07 Nov 2012 13:00:22 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 13:11:32 GMT]]></title><description><![CDATA[<p>out schrieb:</p>
<blockquote>
<p>Ne, auch 4 Byte:</p>
<p><a href="http://en.cppreference.com/w/cpp/language/types" rel="nofollow">http://en.cppreference.com/w/cpp/language/types</a></p>
</blockquote>
<p>Wo liest du eine garantierte Größe von 4 aus der Tabelle? Du kannst höchstens sagen: In den üblichen Implementierungen hat int 32 Bit (und es ist nicht gesagt, dass ein char unbedingt 8 Bit hat). Jeder weiß wohl, dass das beispielsweise früher nicht so war und es gibt da draußen auch wirklich Systeme, auf denen alle Größen gänzlich anders sind<sup>*</sup>.</p>
<p><sup>*</sup>: Und besagte Systeme sind trotzdem 100% standardkonform, eben weil dort nur Mindestgrößen angegeben werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268541</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268541</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 07 Nov 2012 13:11:32 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 13:12:57 GMT]]></title><description><![CDATA[<p>out schrieb:</p>
<blockquote>
<p>Ne, auch 4 Byte:</p>
<p><a href="http://en.cppreference.com/w/cpp/language/types" rel="nofollow">http://en.cppreference.com/w/cpp/language/types</a></p>
</blockquote>
<p>Standardzitat?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268542</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268542</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Wed, 07 Nov 2012 13:12:57 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 13:19:47 GMT]]></title><description><![CDATA[<p>eh danke euch aber ... ist das jetzt die antwort auf meine frage?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268544</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268544</guid><dc:creator><![CDATA[fragender2]]></dc:creator><pubDate>Wed, 07 Nov 2012 13:19:47 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 13:26:17 GMT]]></title><description><![CDATA[<p>Die Antwort auf Deine Frage lautet:<br />
Die Größen von sowohl a) als auch b) hängen nicht nur von der Architektur sondern auch vom verwendeten Compiler (und u.U. dessen Version) ab.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268550</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268550</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Wed, 07 Nov 2012 13:26:17 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 13:39:18 GMT]]></title><description><![CDATA[<blockquote>
<p>Die Antwort auf Deine Frage lautet:<br />
Die Größen von sowohl a) als auch b) hängen nicht nur von der Architektur sondern auch vom verwendeten Compiler (und u.U. dessen Version) ab.</p>
</blockquote>
<p>danke - sehe ich das richtig dass meine obige bemerkung richtig wäre wenn<br />
ich für a) einen 32 Bit compiler auf einer 32 Bit architektur nutze (die 4 Byte für int alloziiert) und für b) eben einen 64 BIt compiler auf 64 Bit architektur (die 8 byte pro int alloziiert) ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268556</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268556</guid><dc:creator><![CDATA[fragender2]]></dc:creator><pubDate>Wed, 07 Nov 2012 13:39:18 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Sat, 10 Nov 2012 20:44:39 GMT]]></title><description><![CDATA[<p>Der Standard sagt:</p>
<p><strong>N3337 §3.9.1 / 2:</strong></p>
<blockquote>
<p>Plain ints have the natural size suggested by the<br />
architecture of the execution environment. [Footnote:] [T]hat 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>
</blockquote>
<p>** <code>&lt;climits&gt;</code> in §18.3.3 / 2:**</p>
<pre><code>The contents are the same as the Standard C library header &lt;limits.h&gt;.
</code></pre>
<p>Und was sagt der C99-Standard?</p>
<p><strong>N1256 §5.2.4.2.1:</strong></p>
<blockquote>
<p>Their implementation-defined values shall be equal or greater in magnitude (absolute value) to those shown, with the same sign.</p>
<p>CHAR_BIT 8</p>
</blockquote>
<p>Ein char hat also mindestens 8 Bit.</p>
<blockquote>
<p>INT_MIN -32767 // -(2^15 - 1)<br />
INT_MAX +32767 // 2^15 - 1</p>
</blockquote>
<p>Und ein int mindestens 16.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268557</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268557</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Sat, 10 Nov 2012 20:44:39 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 15:24:04 GMT]]></title><description><![CDATA[<p>Sone schrieb:</p>
<blockquote>
<blockquote>
<p>INT_MIN -32767 // -(2^15 - 1)<br />
INT_MAX +32767 // 2^15 - 1</p>
</blockquote>
<p>Und ein int mindestens 16.</p>
</blockquote>
<p>Wie kommst du jetzt auf 16? Und was ist die Quelle für dein Zitat? Ich glaube, du hast das mit dem Vorzeichen falsch verstanden. §5.2.4.2.1 ist nicht so <code>int &gt;= [-char;+char]</code> , sondern so zu vertsehen: <code>(signed) int &gt;= (signed) char, unsigned int &gt;= unsigned char</code> , usw.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268599</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268599</guid><dc:creator><![CDATA[Hinweiser]]></dc:creator><pubDate>Wed, 07 Nov 2012 15:24:04 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 15:37:23 GMT]]></title><description><![CDATA[<p>fragender2 schrieb:</p>
<blockquote>
<blockquote>
<p>Die Antwort auf Deine Frage lautet:<br />
Die Größen von sowohl a) als auch b) hängen nicht nur von der Architektur sondern auch vom verwendeten Compiler (und u.U. dessen Version) ab.</p>
</blockquote>
<p>danke - sehe ich das richtig dass meine obige bemerkung richtig wäre wenn<br />
ich für a) einen 32 Bit compiler auf einer 32 Bit architektur nutze (die 4 Byte für int alloziiert) und für b) eben einen 64 BIt compiler auf 64 Bit architektur (die 8 byte pro int alloziiert) ?</p>
</blockquote>
<p>Nein</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268601</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268601</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 07 Nov 2012 15:37:23 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 16:46:33 GMT]]></title><description><![CDATA[<p>fragender2 schrieb:</p>
<blockquote>
<p>danke - sehe ich das richtig dass meine obige bemerkung richtig wäre wenn<br />
ich für a) einen 32 Bit compiler auf einer 32 Bit architektur nutze (die 4 Byte für int alloziiert) und für b) eben einen 64 BIt compiler auf 64 Bit architektur (die 8 byte pro int alloziiert) ?</p>
</blockquote>
<p>Nö. Unter Windows 7 64-Bit auf x86-64 mit einem 64-Bit-Compiler besteht ein int sowie ein long immer noch aus 32 Bits. Unter Linux (auch 64 Bit) auf derselben Kiste hätte ein int 32 Bit und ein long 64 Bit. Beides ist standardkonform.</p>
<p>ints bestehen aus mindestens 16 Bits<br />
longs bestehen aus mindestens 32 Bits.<br />
long longs bestehen aus mindestens 64 Bits.</p>
<p>Wenn es da nicht drauf ankommt, verwende int. Uns sonst haben wir ja noch diverse Typedefs aus &lt;cstdint&gt;, wie z.b. int_fast32_t oder int64_t, wenn du so etwas brauchst. Boost hat auch noch einen Header, der dir dafür Templates anbietet, dass du dir auch einen Typ mit mindestens 25 Bits holen kannst, oder so etwas.</p>
<p>Hinweiser schrieb:</p>
<blockquote>
<p>Sone schrieb:</p>
<blockquote>
<blockquote>
<p>INT_MIN -32767 // -(2^15 - 1)<br />
INT_MAX +32767 // 2^15 - 1</p>
</blockquote>
<p>Und ein int mindestens 16.</p>
</blockquote>
<p>Wie kommst du jetzt auf 16?</p>
</blockquote>
<p>Hast du das Wort &quot;mindestens&quot; übersehen?!</p>
<p>Hinweiser schrieb:</p>
<blockquote>
<p>Ich glaube, du hast das mit dem Vorzeichen falsch verstanden. §5.2.4.2.1 ist nicht so <code>int &gt;= [-char;+char]</code> , sondern so zu vertsehen: <code>(signed) int &gt;= (signed) char, unsigned int &gt;= unsigned char</code> , usw.</p>
</blockquote>
<p>Das kann ich leider nicht deuten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268603</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268603</guid><dc:creator><![CDATA[krümelkacker]]></dc:creator><pubDate>Wed, 07 Nov 2012 16:46:33 GMT</pubDate></item><item><title><![CDATA[Reply to int auf 64 Bit on Wed, 07 Nov 2012 15:42:37 GMT]]></title><description><![CDATA[<p>Hinweiser schrieb:</p>
<blockquote>
<p>Sone schrieb:</p>
<blockquote>
<blockquote>
<p>INT_MIN -32767 // -(2^15 - 1)<br />
INT_MAX +32767 // 2^15 - 1</p>
</blockquote>
<p>Und ein int mindestens 16.</p>
</blockquote>
<p>Wie kommst du jetzt auf 16? Und was ist die Quelle für dein Zitat? Ich glaube, du hast das mit dem Vorzeichen falsch verstanden. §5.2.4.2.1 ist nicht so <code>int &gt;= [-char;+char]</code> , sondern so zu vertsehen: <code>(signed) int &gt;= (signed) char, unsigned int &gt;= unsigned char</code> , usw.</p>
</blockquote>
<p>Quelle ist doch genannt, <a href="http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf" rel="nofollow">N1256</a>...<br />
Wie ich auf 16 komme? Na, da steht doch ganz klar, dass die Beträge der von der Implementation definierten Makros mindestens so groß sein müssen wie die genannten.<br />
Also muss ein Variable vom Typ <code>int</code> mindestens jede Ganzzahl im Intervall \[-(2^{15} - 1) ~,~ 2^{15} - 1\] darstellen können - also mindestens 16 Bit groß sein...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2268607</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2268607</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Wed, 07 Nov 2012 15:42:37 GMT</pubDate></item></channel></rss>