<?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[Inline Assembler - mov Operanten-Grösse]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">//Foo ist ein Typ, welcher eine beliebige Grösse haben kann
Foo Bar = Quux; //Quux ist eine andere Instanz von Foo
Foo Baz;
asm
{[asm]
  mov &amp;Baz, &amp;Bar
[/asm]}
</code></pre>
<p>Erkennt der Inline Assembler die Grösse von Foo und wird er auch die gesamte Instanz kopieren?</p>
<p>MfG, EOutOfResources</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/283990/inline-assembler-mov-operanten-grösse</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 10:11:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/283990.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 23 Mar 2011 16:03:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Wed, 23 Mar 2011 16:03:18 GMT]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">//Foo ist ein Typ, welcher eine beliebige Grösse haben kann
Foo Bar = Quux; //Quux ist eine andere Instanz von Foo
Foo Baz;
asm
{[asm]
  mov &amp;Baz, &amp;Bar
[/asm]}
</code></pre>
<p>Erkennt der Inline Assembler die Grösse von Foo und wird er auch die gesamte Instanz kopieren?</p>
<p>MfG, EOutOfResources</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038884</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038884</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Wed, 23 Mar 2011 16:03:18 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Wed, 23 Mar 2011 19:02:08 GMT]]></title><description><![CDATA[<p><code>mov</code> funktioniert nicht mit beliebigen Typen. Aber warum keine Zuweisung, was willst du erreichen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038989</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038989</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 23 Mar 2011 19:02:08 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Wed, 23 Mar 2011 19:09:25 GMT]]></title><description><![CDATA[<p>Nexus schrieb:</p>
<blockquote>
<p>Aber warum keine Zuweisung, was willst du erreichen?</p>
</blockquote>
<p>Eine Kopie ohne den Zuweisungsoperator aufzurufen.</p>
<p>EDIT: Man, was ist ein Kopieroperator? <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/2038991</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038991</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Wed, 23 Mar 2011 19:09:25 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Wed, 23 Mar 2011 19:06:04 GMT]]></title><description><![CDATA[<p>Was ist ein Kopieroperator? Meinst du Kopierkonstruktor oder Zuweisungsoperator?</p>
<p>Und wieso sollte man das tun wollen? Poste mal eine High-Level-Beschreibung von dem, was du genau planst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038992</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038992</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 23 Mar 2011 19:06:04 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Wed, 23 Mar 2011 19:08:39 GMT]]></title><description><![CDATA[<p>Einen bestimmten Byte-Bereich aus einer Instanz &quot;abkopieren&quot;.<br />
Bsp.:<br />
Klasse A ist 40 Bytes gross.<br />
Ich will nun Byte 12 bis Byte 19 einer Instanz von A in eine weitere Instanz von A kopieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038994</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Wed, 23 Mar 2011 19:08:39 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Wed, 23 Mar 2011 19:09:47 GMT]]></title><description><![CDATA[<p>memcpy ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2038996</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2038996</guid><dc:creator><![CDATA[memcpy (???)]]></dc:creator><pubDate>Wed, 23 Mar 2011 19:09:47 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 09:56:17 GMT]]></title><description><![CDATA[<p>Solche Operationen sollten, wenn sie denn überhaupt Sinn machen, von der Klasse Foo angeboten werden. Und dann ist memcpy das Tool der Wahl. Wenns denn nötig ist.<br />
Von außen auf byte 17-19 zuzugreifen und die dann auch noch in den entsprechenden Bereich eines anderen Objekts zu kopieren ist böse, unportabel und erzeugt undefiniertes Verhalten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039275</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 24 Mar 2011 09:56:17 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 10:00:20 GMT]]></title><description><![CDATA[<p>EOutOfResources schrieb:</p>
<blockquote>
<p>Ich will nun Byte 12 bis Byte 19 einer Instanz von A in eine weitere Instanz von A kopieren.</p>
</blockquote>
<p>Darf man fragen warum?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039280</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039280</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Thu, 24 Mar 2011 10:00:20 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 11:31:57 GMT]]></title><description><![CDATA[<p>pumuckl schrieb:</p>
<blockquote>
<p>.Von außen auf byte 17-19 zuzugreifen und die dann auch noch in den entsprechenden Bereich eines anderen Objekts zu kopieren ist böse, unportabel und erzeugt undefiniertes Verhalten.</p>
</blockquote>
<p>Auch wenn ich den Typ selbst geschrieben habe?</p>
<p>dot schrieb:</p>
<blockquote>
<p>Darf man fragen warum?</p>
</blockquote>
<p>Eine Instanz gezielt modifizieren -&gt; Bestimmen Bereich von eine Vorlage abkopieren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039328</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039328</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Thu, 24 Mar 2011 11:31:57 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 11:36:03 GMT]]></title><description><![CDATA[<p>EOutOfResources schrieb:</p>
<blockquote>
<p>dot schrieb:</p>
<blockquote>
<p>Darf man fragen warum?</p>
</blockquote>
<p>Eine Instanz gezielt modifizieren -&gt; Bestimmen Bereich von eine Vorlage abkopieren</p>
</blockquote>
<p>Und warum kannst du dazu nicht einfach die entsprechenden Member verändern? Im Gegensatz zu irgendwelchen Hacks wär das wohldefiniert und portabel...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039330</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039330</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Thu, 24 Mar 2011 11:36:03 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 11:44:02 GMT]]></title><description><![CDATA[<p>dot schrieb:</p>
<blockquote>
<p>Und warum kannst du dazu nicht einfach die entsprechenden Member verändern?</p>
</blockquote>
<p>Weil es nur Teile von Membern betrifft:</p>
<pre><code>Foo: |Member 01|Member 02          |M3|
          |Modifizieren    |
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2039334</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039334</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Thu, 24 Mar 2011 11:44:02 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 11:47:13 GMT]]></title><description><![CDATA[<p>Wtf, ich hoffe dir ist klar dass das ein absoluter Hack ist!? Wenn du wirklich meinst das tun zu müssen: memcpy() ist aber natürlich total undefiniertes Verhalten...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039336</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039336</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Thu, 24 Mar 2011 11:47:13 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 11:49:09 GMT]]></title><description><![CDATA[<p>dot schrieb:</p>
<blockquote>
<p>total undefiniertes Verhalten...</p>
</blockquote>
<p>Wieso? Ich habe Foo geschrieben und weiss, wie es funktioniert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039338</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039338</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Thu, 24 Mar 2011 11:49:09 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 12:08:34 GMT]]></title><description><![CDATA[<blockquote>
<p>Klasse A ist 40 Bytes gross.<br />
Ich will nun Byte 12 bis Byte 19 einer Instanz von A in eine weitere Instanz von A kopieren.</p>
</blockquote>
<pre><code class="language-cpp">void copyA(A&amp; dest, A const&amp; source)
{
  uint64_t bytes = *static_cast&lt;const uint64_t*&gt;(static_cast&lt;const void*&gt;(&amp;source) + 11);
  *static_cast&lt;uint64_t*&gt;(static_cast&lt;void*&gt;(&amp;dest) + 11) = bytes;
}
</code></pre>
<p>Gerade eben runtergetippt, sollte funktionieren.</p>
<p>Bist du zufälligerweise in einem fremden Prozess/Code, zb per DLL-Injection? Wenn nicht, dann ist deine Idee grausam.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039352</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039352</guid><dc:creator><![CDATA[Ethon]]></dc:creator><pubDate>Thu, 24 Mar 2011 12:08:34 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 12:11:08 GMT]]></title><description><![CDATA[<p>Ethon schrieb:</p>
<blockquote>
<p>Bist du zufälligerweise in einem fremden Prozess/Code</p>
</blockquote>
<p>Fremder Prozess, mein Code. Meine Anwendung greift auf eine andere meiner Anwendungen zu...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039356</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039356</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Thu, 24 Mar 2011 12:11:08 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 12:12:32 GMT]]></title><description><![CDATA[<p>EOutOfResources schrieb:</p>
<blockquote>
<p>dot schrieb:</p>
<blockquote>
<p>total undefiniertes Verhalten...</p>
</blockquote>
<p>Wieso? Ich habe Foo geschrieben und weiss, wie es funktioniert.</p>
</blockquote>
<p>Hast du an Padding gedacht? Hast du dir tausend Kommentare geschrieben, dass niemand jemals die Klasse ändern darf?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039357</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039357</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Thu, 24 Mar 2011 12:12:32 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 12:13:39 GMT]]></title><description><![CDATA[<p>EOutOfResources schrieb:</p>
<blockquote>
<p>dot schrieb:</p>
<blockquote>
<p>total undefiniertes Verhalten...</p>
</blockquote>
<p>Wieso? Ich habe Foo geschrieben und weiss, wie es funktioniert.</p>
</blockquote>
<p>Aber Compiler fügen standardmäßig Füllbits zwischen die Member Klasse / Struktur ein.<br />
Daher solltest du das Alignment per pragma vor die Klassendefinition auf einen wohldefinierten Wert (wenn nötig auf 1 Byte) ändern, und in deinem Code kommentieren, warum du dies gemacht hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039358</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039358</guid><dc:creator><![CDATA[_Falke]]></dc:creator><pubDate>Thu, 24 Mar 2011 12:13:39 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 12:15:50 GMT]]></title><description><![CDATA[<p>Ups, Padding. Jetzt verstehe ich es...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039359</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039359</guid><dc:creator><![CDATA[EOutOfResources]]></dc:creator><pubDate>Thu, 24 Mar 2011 12:15:50 GMT</pubDate></item><item><title><![CDATA[Reply to Inline Assembler - mov Operanten-Grösse on Thu, 24 Mar 2011 12:57:09 GMT]]></title><description><![CDATA[<p>EOutOfResources schrieb:</p>
<blockquote>
<p>dot schrieb:</p>
<blockquote>
<p>total undefiniertes Verhalten...</p>
</blockquote>
<p>Wieso? Ich habe Foo geschrieben und weiss, wie es funktioniert.</p>
</blockquote>
<p>Weil auch wenn du die Klasse selber geschrieben hast undefiniertes Verhalten dabei rauskommt, wenn du ohne über die Klassenmethoden bzw. Member zu gehen, byteweise deine Objekte vermurkst.<br />
Undefiniertes Verhalten heißt, es kann keine Aussage drüber gemacht werden was genau passiert.<br />
Wenn du deinen Compiler genau kennst und das was er an Code für deine Plattform erzeugt, dann kann das durchaus funktionieren. Es ist aber nicht garantiert, dass es auf einer anderen Plattform oder mit der nächsten Version deines Compilers auch noch funktioniert, geschweige denn mit einem anderen Compiler.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2039395</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2039395</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 24 Mar 2011 12:57:09 GMT</pubDate></item></channel></rss>