<?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[Portierung Code]]></title><description><![CDATA[<p>Hallo,</p>
<p>welche Änderungen müßte ich an einem C++ Code z.b. machen wenn ich ihn von Windows nach Linux portiere ? C++ ist ja nicht platformunabhängig da muss bestimmt was geändert werden ? Nur mal einige Beispiele.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/323824/portierung-code</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 13:59:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/323824.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 18 Feb 2014 10:33:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 10:33:56 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>welche Änderungen müßte ich an einem C++ Code z.b. machen wenn ich ihn von Windows nach Linux portiere ? C++ ist ja nicht platformunabhängig da muss bestimmt was geändert werden ? Nur mal einige Beispiele.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383827</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383827</guid><dc:creator><![CDATA[blurry333]]></dc:creator><pubDate>Tue, 18 Feb 2014 10:33:56 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 10:46:48 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<p>C++ ist ja nicht platformunabhängig</p>
</blockquote>
<p>Doch. Standard-C++ jedenfalls.</p>
<p>Spezielle Bibliotheken sind möglicherweise nur eingeschränkt nutzbar.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383829</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383829</guid><dc:creator><![CDATA[daddy_felix]]></dc:creator><pubDate>Tue, 18 Feb 2014 10:46:48 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 10:46:52 GMT]]></title><description><![CDATA[<p>Doch, C++ ist plattformunabhaengig. Der Code, den Du damit schreibst ist - oft - plattformabhaengig. Zumindest, wenn Du nicht eine die Plattform abstrahierende Bibliothek, wie z.B. Qt nutzt.</p>
<p>Um Deine Frage zu beantworten: Du muss GUI Code und plattformspezifische Klassen/Funktionen portieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383830</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383830</guid><dc:creator><![CDATA[pform]]></dc:creator><pubDate>Tue, 18 Feb 2014 10:46:52 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 10:53:37 GMT]]></title><description><![CDATA[<p>blurry333 schrieb:</p>
<blockquote>
<p>welche Änderungen müßte ich an einem C++ Code z.b. machen wenn ich ihn von Windows nach Linux portiere ?</p>
</blockquote>
<p>Das hängt vom Code ab.</p>
<p>blurry333 schrieb:</p>
<blockquote>
<p>C++ ist ja nicht platformunabhängig</p>
</blockquote>
<p>Doch, bis auf ein paar Libraries (vielleicht) schon.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383832</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383832</guid><dc:creator><![CDATA[Singender Holzkübel]]></dc:creator><pubDate>Tue, 18 Feb 2014 10:53:37 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 10:59:16 GMT]]></title><description><![CDATA[<p>In der Theorie nichts. Core-language, standard-library und boost sollten plattformunabhängig sein. Auf 3rd party libraries, z.B. windows.h musst du aber natürlich verzichten. Ein einfaches Konsolenprogramm, dass nur einen Algorithmus nutzt, sollte aber eigentlich plattformunabhängig sein.</p>
<p>Praktisch musst du aber auf jede Menge aufpassen, hauptsächlich weil die Compiler jede Menge zusätzliche &quot;Features&quot; haben, die man beim programmieren unbewusst nutzt und die erst bei einem neuen Compiler auffallen. Die besten Fehlermeldungen und striktestens Sicherheitsvorkehrungen hat Clang, also es lohnt sich plattformunabhängigen Code mit Clang zu testen.</p>
<p>Gerade bei casts musst du vorsichtig sein, aber nicht unbedingt wegen der &quot;windows-linux&quot; Kompatibilität, sondern wegen 32 und 64 bit.</p>
<p>Strenggenommen gibt es noch jede Menge Sonderfälle, die man beachten muss, aber üblicherweise kann man davon ausgehen, dass man z.B. Zahlendarstellung im Zweierkomplement hat und</p>
<pre><code>auto a = static_cast&lt;std::uint16_t&gt;(-1)
</code></pre>
<p>das Gleiche ist wie</p>
<pre><code>std::uint16_t a = 0xffff
</code></pre>
<p>.</p>
<p>EDIT: Schreibfehler korrigiert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383833</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383833</guid><dc:creator><![CDATA[Marthog]]></dc:creator><pubDate>Tue, 18 Feb 2014 10:59:16 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 11:00:52 GMT]]></title><description><![CDATA[<p>Marthog schrieb:</p>
<blockquote>
<p>Strenggenommen gibt es noch jede Menge Sonderfälle, die man beachten muss, aber üblicherweise kann man davon ausgehen, dass man z.B. Zahlendarstellung im Zweierkomplement hat und</p>
<pre><code>auto a = static_cast&lt;std::uint16_t&gt;(-1)
</code></pre>
<p>das Gleiche ist wie</p>
<pre><code>std::uint64_t a = 0xffff
</code></pre>
<p>.</p>
</blockquote>
<p>uint16_t != uint64_t<br />
Ansonsten schlechtes Beispiel weil nicht von der Zahlendarstellung abhängig. Diese Identität ist garantiert - mal abgesehen davon, dass die bloße Existenz der intNN_t Typen Zweikomplement impliziert <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="😉"
    /> C11 7.18.1.1</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383836</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Tue, 18 Feb 2014 11:00:52 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 11:54:05 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<p>mal abgesehen davon, dass die bloße Existenz der intNN_t Typen Zweikomplement impliziert <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="😉"
    /> C11 7.18.1.1</p>
</blockquote>
<p>Cool, das wusste ich gar nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383852</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383852</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Tue, 18 Feb 2014 11:54:05 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 12:01:17 GMT]]></title><description><![CDATA[<blockquote>
<p>dass die bloße Existenz der intNN_t Typen Zweikomplement impliziert</p>
</blockquote>
<p>Der Standard legt sich schon ganz allgemein auf Darstellungen fest</p>
<blockquote>
<p>this International Standard permits 2’s complement, 1’s complement and signed magnitude representations for integral types.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2383855</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383855</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Tue, 18 Feb 2014 12:01:17 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 12:03:51 GMT]]></title><description><![CDATA[<p>Moment camper, dein Zitat stimmt doch gar nicht - es ist Paragraph 7.<strong>20</strong>.1.1.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383856</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383856</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Tue, 18 Feb 2014 12:03:51 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 12:31:49 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<blockquote>
<p>dass die bloße Existenz der intNN_t Typen Zweikomplement impliziert</p>
</blockquote>
<p>Der Standard legt sich schon ganz allgemein auf Darstellungen fest</p>
<blockquote>
<p>this International Standard permits 2’s complement, 1’s complement and signed magnitude representations for integral types.</p>
</blockquote>
</blockquote>
<p>Arcoth.<br />
Plural != Singular.<br />
Ja, der Standard legt sich ganz allgemein auf Darstellung<strong>en</strong> fest. Was bringt mir das wenn ich nicht dreifach Code schreiben will?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383861</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383861</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Tue, 18 Feb 2014 12:31:49 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 12:45:36 GMT]]></title><description><![CDATA[<p>Hm, das ist mir noch nicht ganz klar.<br />
Wenn ein int32_t also ein 32 bit integer mit two's complement ist, ist dann auch das Verhalten bei overflow und underflow definiert?</p>
<pre><code>#include &lt;cstdio&gt;
#include &lt;cstdint&gt;

void func(std::int32_t i)
{
	if(i &gt; i+1)
		std::fputs(&quot;overflow\n&quot;, stdout);
	else
		std::fputs(&quot;no overflow\n&quot;, stdout);
}
</code></pre>
<p>compiler output:</p>
<pre><code>main.cpp: In function 'void func(int32_t)':
main.cpp:6:11: warning: assuming signed overflow does not occur when assuming that (X + c) &lt; X is always false [-Wstrict-overflow]
  if(i &gt; i+1)
           ^
</code></pre>
<p>Ist die Warnung richtig oder falsch?<br />
Laut assembler-output wird overflow hier wegoptimiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383866</guid><dc:creator><![CDATA[Flashput]]></dc:creator><pubDate>Tue, 18 Feb 2014 12:45:36 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 12:52:01 GMT]]></title><description><![CDATA[<p>Der C++ Standard garantiert Overflow-Verhalten nur für unsigned Typen.<br />
Ob es da für die <code>intXX_t</code> ne Spezialregelung gibt, weiss ich nicht. camper wird's wissen <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/2383868</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383868</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Tue, 18 Feb 2014 12:52:01 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 13:39:47 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<p>Moment camper, dein Zitat stimmt doch gar nicht - es ist Paragraph 7.<strong>20</strong>.1.1.</p>
</blockquote>
<p>naja fasst, wollte C99 schreiben, und hatte schon C11 aufgeschlagen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383874</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383874</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Tue, 18 Feb 2014 13:39:47 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 13:43:06 GMT]]></title><description><![CDATA[<p>hustbaer schrieb:</p>
<blockquote>
<p>Der C++ Standard garantiert Overflow-Verhalten nur für unsigned Typen.<br />
Ob es da für die <code>intXX_t</code> ne Spezialregelung gibt, weiss ich nicht. camper wird's wissen <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>
</blockquote>
<p>Eine Spezialregelung wäre seltsam - zumal ja viele Rechnungen sowieso erst eine Promotion erfordern, bei denen dann eine solche Regelung ins Leere laufen würde. also: gibt's nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383876</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383876</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Tue, 18 Feb 2014 13:43:06 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 14:10:02 GMT]]></title><description><![CDATA[<p>Ist dann nicht die two's complement Bedingung relativ sinnlos?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383886</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383886</guid><dc:creator><![CDATA[Flashput]]></dc:creator><pubDate>Tue, 18 Feb 2014 14:10:02 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 14:38:20 GMT]]></title><description><![CDATA[<p>Flashput schrieb:</p>
<blockquote>
<p>Ist dann nicht die two's complement Bedingung relativ sinnlos?</p>
</blockquote>
<p>wieso? Zweikomplement sagt etwas aus über die Darstellung (Repräsentation) negativer Zahlen und entsprechend den Wertebereich des Typs. Die Repräsentation ist nat. nur relevant, wenn der Typ mal byteweise gelesen wird oder durch den zugehörigen vorzeichenlosen Typen. Zweikomplement hat den Vorteil das Letzteres tatsächlich zum gleichen Ergebnis führt wie eine normale Konvertierung.</p>
<p>Also</p>
<pre><code class="language-cpp">int32_t x = -42; // irgendwas negatives
uint32_t y = x;
auto z = reinterpret_cast&lt;uint32_t&amp;&gt;(x);
assert(y==z); // nur bei Zweierkomplement
</code></pre>
<p>in der umgekehrten Richtung steht wieder im Weg, dass die Konvertierung von vorzeichenlos in vorzeichenbehaftet implementation-defined ist, könnte also schiefgehen, praktisch wird es das nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383893</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383893</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Tue, 18 Feb 2014 14:38:20 GMT</pubDate></item><item><title><![CDATA[Reply to Portierung Code on Tue, 18 Feb 2014 16:38:17 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/6642">@camper</a><br />
Wenn dann würde es natürlich nur Sinn machen, wenn von Plattformen die <code>intXX_t</code> Typen anbieten verlangt wird, dass alle Integer-Typen das gewohnte Two's-Complement Überlaufverhalten zeigen.<br />
Und auch alle Konvertierungen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2383914</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2383914</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Tue, 18 Feb 2014 16:38:17 GMT</pubDate></item></channel></rss>