<?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[Struktur ist 16 Byte Groß]]></title><description><![CDATA[<pre><code class="language-cpp">typedef struct _PRJ3DFILEHEADER
{
	char FileType[5];
	int  n_Vertex;
	int  n_Indice;

} PRJ3DFILEHEADER;
</code></pre>
<p>Wenn ich mir das ausrechne:<br />
2 x sizeof(int) = 8<br />
8 + 5 = 13...<br />
Der Compiler macht hier dennoch 16 Byte draus... gibt es da irgendein Schlüsselwort, welches genau dieses verhindert? Ich brauche hier in diesem Fall 13 Byte.</p>
<p>Benutze den MsVC++ 7.0</p>
<p>MFG;</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/139157/struktur-ist-16-byte-groß</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 10:38:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/139157.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 03 Mar 2006 21:13:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Struktur ist 16 Byte Groß on Fri, 03 Mar 2006 21:13:26 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">typedef struct _PRJ3DFILEHEADER
{
	char FileType[5];
	int  n_Vertex;
	int  n_Indice;

} PRJ3DFILEHEADER;
</code></pre>
<p>Wenn ich mir das ausrechne:<br />
2 x sizeof(int) = 8<br />
8 + 5 = 13...<br />
Der Compiler macht hier dennoch 16 Byte draus... gibt es da irgendein Schlüsselwort, welches genau dieses verhindert? Ich brauche hier in diesem Fall 13 Byte.</p>
<p>Benutze den MsVC++ 7.0</p>
<p>MFG;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1008058</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1008058</guid><dc:creator><![CDATA[....]]></dc:creator><pubDate>Fri, 03 Mar 2006 21:13:26 GMT</pubDate></item><item><title><![CDATA[Reply to Struktur ist 16 Byte Groß on Fri, 03 Mar 2006 21:16:51 GMT]]></title><description><![CDATA[<p>nein das geht nicht, weil der compieler immer nur mit 16 byte einheiten rechnen kann<br />
Bedank dich bei intel&amp;co wegen dem neuen 64er befehlssatz^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1008061</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1008061</guid><dc:creator><![CDATA[strummelbunzi]]></dc:creator><pubDate>Fri, 03 Mar 2006 21:16:51 GMT</pubDate></item><item><title><![CDATA[Reply to Struktur ist 16 Byte Groß on Fri, 03 Mar 2006 21:45:08 GMT]]></title><description><![CDATA[<p>Nein, das ist das Alignment.</p>
<p>&quot;char FileType[5]&quot; belegt 5 Byte, wird auf 8 aufgefüllt. Dann zwei int dazu sind 16 Byte. Dies nennt man Strukturausrichtung und kann in MSVC++ beeinflusst/abschaltet werden. Wie es mit anderen Compilern ist weiß ich nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1008089</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1008089</guid><dc:creator><![CDATA[Neku]]></dc:creator><pubDate>Fri, 03 Mar 2006 21:45:08 GMT</pubDate></item><item><title><![CDATA[Reply to Struktur ist 16 Byte Groß on Fri, 03 Mar 2006 21:45:35 GMT]]></title><description><![CDATA[<p><a href="http://www.eventhelix.com/RealtimeMantra/ByteAlignmentAndOrdering.htm" rel="nofollow">http://www.eventhelix.com/RealtimeMantra/ByteAlignmentAndOrdering.htm</a></p>
<p>Google: Compiler, Padding (bytes), (Byte) Alignment<br />
Das kann man oft in den Optionen umstellen (bzw. per Parameter), sollte man aber nicht</p>
<p>Übrigens ist das bestimmt kein Nachteil, das macht die Sache schneller und auf die paar Bytes kann man im Normalfall verzichten. (anderst ist das z.B. bei embedded Systemen)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1008090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1008090</guid><dc:creator><![CDATA[Ich hab Ahnung!]]></dc:creator><pubDate>Fri, 03 Mar 2006 21:45:35 GMT</pubDate></item><item><title><![CDATA[Reply to Struktur ist 16 Byte Groß on Fri, 03 Mar 2006 22:01:17 GMT]]></title><description><![CDATA[<p>Nun ja, in diesem Fall ist das ein Fileheader, und da stören mich die 3 sinnlosen Byte. Bei anderen Strukturen ist es natürlich schön, das der Compiler das so macht, wegen der Geschwindigkeit...</p>
<p>MFG;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1008101</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1008101</guid><dc:creator><![CDATA[....]]></dc:creator><pubDate>Fri, 03 Mar 2006 22:01:17 GMT</pubDate></item><item><title><![CDATA[Reply to Struktur ist 16 Byte Groß on Fri, 03 Mar 2006 22:04:54 GMT]]></title><description><![CDATA[<p>Ich verlasse mich bei Strukturen (Klassen) nicht darauf, wie groß sie ist und wie die Variablen angeordnet sind. Lieber manuell auslesen und dann Wert für Wert in das Objekt schreiben.</p>
<p>Wenn man dann noch schön Operatoren überläd kann das recht übersichtlich werden:</p>
<pre><code class="language-cpp">xFile &gt;&gt; h-&gt;uName
      &gt;&gt; (uint32&amp;)h-&gt;eType
      &gt;&gt; h-&gt;uFlags
      &gt;&gt; h-&gt;uAddress
      &gt;&gt; h-&gt;uOffset
      &gt;&gt; h-&gt;uSize
      &gt;&gt; h-&gt;uLink
      &gt;&gt; h-&gt;uInfo
      &gt;&gt; h-&gt;uAddressAlign
      &gt;&gt; h-&gt;uEntrySize;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1008106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1008106</guid><dc:creator><![CDATA[Neku]]></dc:creator><pubDate>Fri, 03 Mar 2006 22:04:54 GMT</pubDate></item></channel></rss>