<?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[ntohl usw...]]></title><description><![CDATA[<p>Hallo, mann benutzt ja ntohl bzw htons um byteorders anzupassen ... verschiedene plattformen etc... aber dort wird nur die möglichkeit gegeben, short bzw long zu konvertieren... kann man dann davon aus gehen, dass alle anderen daten typen:<br />
double, float, char auf jeder plattform immer die gleiche größe haben ?!<br />
Kann auch sein dass ich grade ein paar dinge verwechsle...<br />
Gruß Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/205973/ntohl-usw</link><generator>RSS for Node</generator><lastBuildDate>Sat, 10 Oct 2026 07:03:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/205973.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Feb 2008 21:46:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ntohl usw... on Tue, 19 Feb 2008 22:28:27 GMT]]></title><description><![CDATA[<p>Hallo, mann benutzt ja ntohl bzw htons um byteorders anzupassen ... verschiedene plattformen etc... aber dort wird nur die möglichkeit gegeben, short bzw long zu konvertieren... kann man dann davon aus gehen, dass alle anderen daten typen:<br />
double, float, char auf jeder plattform immer die gleiche größe haben ?!<br />
Kann auch sein dass ich grade ein paar dinge verwechsle...<br />
Gruß Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459146</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459146</guid><dc:creator><![CDATA[Foxx90]]></dc:creator><pubDate>Tue, 19 Feb 2008 22:28:27 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 09:42:42 GMT]]></title><description><![CDATA[<p>Foxx90 schrieb:</p>
<blockquote>
<p>kann man dann davon aus gehen, dass alle anderen daten typen:<br />
double, float, char auf jeder plattform immer die gleiche größe haben ?!</p>
</blockquote>
<p>Nein. Ich glaube es gibt in C++ nur ein Typ wo der Standard besagt das er genau ein Byte groß ist: char.</p>
<p>Ansonsten gibt es nur Regeln wie folgende: float &lt;= double...</p>
<p>cu André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459281</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459281</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Wed, 20 Feb 2008 09:42:42 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 13:12:08 GMT]]></title><description><![CDATA[<p>ok also ntohl etc sind für die bytedarstellung wichtig... aber wie ist das denn jetzt bei floats.. doubles? werden die auf jeder plattform gleich dargestellt ?<br />
oder muss ich erst float in int umwandeln und dann die ints mit ntohl etc.. bearbeiten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459422</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459422</guid><dc:creator><![CDATA[Foxx90]]></dc:creator><pubDate>Wed, 20 Feb 2008 13:12:08 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 16:41:04 GMT]]></title><description><![CDATA[<p>asc  schrieb:</p>
<blockquote>
<p>Nein. Ich glaube es gibt in C++ nur ein Typ wo der Standard besagt das er genau ein Byte groß ist: char.</p>
</blockquote>
<p>Ja, das stimmt, aber es gibt weiter noch short: 16 Bit, long: 32 Bit.</p>
<p>Der Rest gilt nur durch Abhängikeiten.</p>
<p>char &lt;= short &lt;= int &lt;= long</p>
<p>float &lt;= double &lt;= long double</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459609</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459609</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 20 Feb 2008 16:41:04 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 17:11:28 GMT]]></title><description><![CDATA[<p>drakon schrieb:</p>
<blockquote>
<p>Ja, das stimmt, aber es gibt weiter noch short: 16 Bit, long: 32 Bit.</p>
</blockquote>
<p>Wie kommst Du auf diesen Blödsinn!?</p>
<p>ISO/IEC 14882:2003(E) schrieb:</p>
<blockquote>
<p>3.9.1 Fundamental types [basic.fundamental]</p>
<ol start="2">
<li>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 environment(39) ; the other signed integer types are provided to meet special needs.</li>
</ol>
<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 type40) ; 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>(39) 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>
</blockquote>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459625</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459625</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 20 Feb 2008 17:11:28 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 17:15:03 GMT]]></title><description><![CDATA[<p>Ok, abe rehrlich gesagt verstehe ich nicht wofür man genau ntohl etc braucht .. ?<br />
Oder besser gesagt wie werden float gehandhabt ...<br />
Ich mein ich weiß dass diese funktionen lediglich little / big - endian umwandeln..<br />
und das nur bei long / short.. was ist denn mit floats ?! oder doubles... muss man die nicht iwie in netbyte order umwandeln und gegebenfalls wieder umwandeln ?!</p>
<p>Gruß Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459627</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459627</guid><dc:creator><![CDATA[Foxx90]]></dc:creator><pubDate>Wed, 20 Feb 2008 17:15:03 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 21:40:49 GMT]]></title><description><![CDATA[<p>Foxx90 schrieb:</p>
<blockquote>
<p>ok also ntohl etc sind für die bytedarstellung wichtig... aber wie ist das denn jetzt bei floats.. doubles? werden die auf jeder plattform gleich dargestellt ?<br />
oder muss ich erst float in int umwandeln und dann die ints mit ntohl etc.. bearbeiten?</p>
</blockquote>
<p>das würde wohl auch nicht portabel sein. konvertiere float/double lieber in ein format, dass du selbst bestimmst (und wenn es nur ASCII ist) - ansonsten musst du wohl nachforschen, ob dein compiler dir IEEE-float unterstützung anbietet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459667</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459667</guid><dc:creator><![CDATA[queer_boy]]></dc:creator><pubDate>Wed, 20 Feb 2008 21:40:49 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 18:31:23 GMT]]></title><description><![CDATA[<p>Swordfish schrieb:</p>
<blockquote>
<p>drakon schrieb:</p>
<blockquote>
<p>Ja, das stimmt, aber es gibt weiter noch short: 16 Bit, long: 32 Bit.</p>
</blockquote>
<p>Wie kommst Du auf diesen Blödsinn!?</p>
</blockquote>
<p>Das folgt aus den Mindestgrößen der Konstanten, die in limits.h/climits definiert werden.<br />
ISO 9899: 5.2.4.2.1</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459682</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 20 Feb 2008 18:31:23 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 18:46:14 GMT]]></title><description><![CDATA[<p>Swordfish schrieb:</p>
<blockquote>
<p>drakon schrieb:</p>
<blockquote>
<p>Ja, das stimmt, aber es gibt weiter noch short: 16 Bit, long: 32 Bit.</p>
</blockquote>
<p>Wie kommst Du auf diesen Blödsinn!?</p>
</blockquote>
<p>Wie Camper schon schrib. Und es steht auch im &quot;The C++ Programming Language&quot;...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459694</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459694</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 20 Feb 2008 18:46:14 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 18:52:48 GMT]]></title><description><![CDATA[<p>*snipp*</p>
<p>sry, hab mich verklickt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459695</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459695</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Wed, 20 Feb 2008 18:52:48 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 18:50:01 GMT]]></title><description><![CDATA[<p>Ok, in welches Format würdest du es denn formatieren ?! zum Beipspiel in chars ?<br />
Wobei es ja dann auch wieder nicht portabel ist <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/1459700</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459700</guid><dc:creator><![CDATA[Foxx90]]></dc:creator><pubDate>Wed, 20 Feb 2008 18:50:01 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 18:56:03 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<p>Das folgt aus den Mindestgrößen der Konstanten, die in limits.h/climits definiert werden.<br />
ISO 9899: 5.2.4.2.1</p>
</blockquote>
<p>erstens sind es <strong>mindest</strong>größen und zweitens folgt das nur dann draus, wenn man davon ausgeht, dass das system auf einer entsprechenden integerrepräsentation (z.B. zweierkomplementdarstellung) basiert, was wiederum nirgendwo festegelegt ist. was den speicherbedarf angeht definiert der standard afaik nur dass gilt:</p>
<pre><code class="language-cpp">sizeof(char) == 1
</code></pre>
<p>und</p>
<pre><code class="language-cpp">sizeof(char) &lt;= sizeof(short) &lt;= sizeof(int) &lt;= sizeof(long)
</code></pre>
<p>man beachte: das wort bit oder byte fällt da nirgendwo...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459702</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459702</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Wed, 20 Feb 2008 18:56:03 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 19:15:25 GMT]]></title><description><![CDATA[<p>Ich war mir eben auch nicht sicher, dann habe ich noch mal im Buch nachgeschaut und dort steht eben, dass GARANTIERT ist, dass short 16 und long 32 Bit hat...</p>
<p>EDIT:</p>
<p>Ok, garantiert MINDESTENS..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459706</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459706</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 20 Feb 2008 19:15:25 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 19:10:31 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/6642">@camper</a>: Wenn Du schon das genaue Kapitel ansprichst, dann möchte ich daraus etwas hervorheben:</p>
<p>ISO/IEC 9899:1999 (E) schrieb:</p>
<blockquote>
<p>5.2.4.2.1 Sizes of integer types &lt;limits.h&gt;<br />
1 <strong>The values given below shall be replaced</strong> by constant expressions suitable for use in #if<br />
preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the<br />
following shall be replaced by expressions that have the same type as would an<br />
expression that is an object of the corresponding type converted according to the integer<br />
promotions. Their <strong>implementation-defined values shall be equal or greater in magnitude</strong><br />
(absolute value) to those shown, with the same sign.</p>
</blockquote>
<p>Somit ist &quot;ein <code>short</code> hat genau 16 Bits&quot; und &quot;ein <code>long</code> hat genau 32 Bits&quot; quatsch.</p>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459714</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459714</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 20 Feb 2008 19:10:31 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 19:45:00 GMT]]></title><description><![CDATA[<p>Swordfish schrieb:</p>
<blockquote>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/6642">@camper</a>: Wenn Du schon das genaue Kapitel ansprichst, dann möchte ich daraus etwas hervorheben:</p>
<p>ISO/IEC 9899:1999 (E) schrieb:</p>
<blockquote>
<p>5.2.4.2.1 Sizes of integer types &lt;limits.h&gt;<br />
1 <strong>The values given below shall be replaced</strong> by constant expressions suitable for use in #if<br />
preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the<br />
following shall be replaced by expressions that have the same type as would an<br />
expression that is an object of the corresponding type converted according to the integer<br />
promotions. Their <strong>implementation-defined values shall be equal or greater in magnitude</strong><br />
(absolute value) to those shown, with the same sign.</p>
</blockquote>
<p>Somit ist &quot;ein <code>short</code> hat genau 16 Bits&quot; und &quot;ein <code>long</code> hat genau 32 Bits&quot; quatsch.</p>
<p>greetz, Swordfish</p>
</blockquote>
<p>Das Wort &quot;genau&quot; wurde gar nicht benutzt (und ich habe es nat. nie gemeint; wir alle sind 32bit-Integer gewohnt, vorgeschrieben sind dort aber nur mindestens 16bit), ich gebe aber zu, dass man das missverstehen konnte - aber schließlich habe ich sogar selbst von Mindestgrößen gesprochen..., hier will mich evtl. jemand missverstehen. Allerdings bezweifle ich auch (und es ist mir daher auch nicht in den Sinn gekommen), dass drakon &quot;genau&quot; meinte, denn dann sind die folgenden Ungleichungen nahezu überflüssig.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/6496">@dot</a>: unabhängig von der konkreten Darstellung muss z.B. ein short wenigstens 2*65535+1 verschiedene Zustände darstellen können, das geht nur mit wenigstens 16 bit für die value-Repräsentation. Alle Integertypen benutzen das Binärsystem um ihren Wert festzulegen - zudem sind nur 3 verschiedene Arten für die Darstellung negativer Zahlen zugelassen:<br />
- Zweierkomplement<br />
- Einerkomplement<br />
- Vorzeichen+Betrag</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459743</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 20 Feb 2008 19:45:00 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 19:58:59 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<p>Das Wort &quot;genau&quot; wurde gar nicht benutzt</p>
</blockquote>
<p>Ich will dich nicht Missverstehen, es hat für mich den Anschein gehabt, denn:</p>
<p>drakon schrieb:</p>
<blockquote>
<p>asc  schrieb:</p>
<blockquote>
<p>Nein. Ich glaube es gibt in C++ nur ein Typ wo der Standard besagt das er <strong>genau ein Byte</strong> groß ist: char.</p>
</blockquote>
<p>Ja, das stimmt, aber <strong>es gibt weiter noch</strong> short: 16 Bit, long: 32 Bit.</p>
</blockquote>
<p>...impliziert IMVVHO ein <em>genau</em>. Also sind wir uns jetzt einig, dass</p>
<p><code>sizeof( char ) == sizeof( unsigned char ) == sizeof( signed char ) == 1</code><br />
<code>2 &lt;= sizeof( short int ) &lt;= sizeof( int ) &lt;= 4 &lt;= sizeof( long int )</code><br />
?</p>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459755</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459755</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 20 Feb 2008 19:58:59 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 19:59:20 GMT]]></title><description><![CDATA[<blockquote>
<p>...impliziert IMVVHO ein genau. Also sind wir uns jetzt einig, dass</p>
</blockquote>
<p>Sry. Habe ich nicht so gemeint.</p>
<blockquote>
<p>sizeof( char ) == sizeof( unsigned char ) == sizeof( signed char ) == 1<br />
2 &lt;= sizeof( short int ) &lt;= sizeof( int ) &lt;= 4 &lt;= sizeof( long )</p>
</blockquote>
<p>So habe ich es gemeint und bin einverstanden. <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/1459758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459758</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 20 Feb 2008 19:59:20 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 20:07:03 GMT]]></title><description><![CDATA[<p>Swordfish schrieb:</p>
<blockquote>
<p>camper schrieb:</p>
<blockquote>
<p>Das Wort &quot;genau&quot; wurde gar nicht benutzt</p>
</blockquote>
<p>Ich will dich nicht Missverstehen, es hat für mich den Anschein gehabt, denn:</p>
<p>drakon schrieb:</p>
<blockquote>
<p>asc  schrieb:</p>
<blockquote>
<p>Nein. Ich glaube es gibt in C++ nur ein Typ wo der Standard besagt das er <strong>genau ein Byte</strong> groß ist: char.</p>
</blockquote>
<p>Ja, das stimmt, aber <strong>es gibt weiter noch</strong> short: 16 Bit, long: 32 Bit.</p>
</blockquote>
<p>...impliziert IMVVHO ein <em>genau</em>.</p>
</blockquote>
<p>Es kann so interpretiert werden. Es ist aber nicht die einzig mögliche Deutung.</p>
<blockquote>
<p>Also sind wir uns jetzt einig, dass</p>
<p><code>sizeof( char ) == sizeof( unsigned char ) == sizeof( signed char ) == 1</code><br />
<code>2 &lt;= sizeof( short int ) &lt;= sizeof( int ) &lt;= 4 &lt;= sizeof( long int )</code><br />
?</p>
</blockquote>
<p>Auf keinen Fall. Nirgendwo steht, dass 1 &lt; sizeof(short) oder 3&lt;sizeof(long) ist.<br />
char kann ohne weiteres auch 32bit haben, und dann ist sizeof(long)==1 absolut möglich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459763</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459763</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 20 Feb 2008 20:07:03 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 20:14:03 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<p>Auf keinen Fall.</p>
</blockquote>
<p>Verdammt.</p>
<p>greetz, Swordfish</p>
<p>PS: <code>assert( CHAR_BITS == 8 );</code> <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/1459773</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459773</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 20 Feb 2008 20:14:03 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 20:15:27 GMT]]></title><description><![CDATA[<blockquote>
<p>PS: <code>assert( CHAR_BITS == 8 );</code> <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>Haha..:D - Ich habe jetzt DAS einfach mal angenommen. <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/1459775</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459775</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 20 Feb 2008 20:15:27 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 20:18:42 GMT]]></title><description><![CDATA[<p>Tja, <em>angenommen</em>, man irrt sich <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>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459778</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459778</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 20 Feb 2008 20:18:42 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 20:23:42 GMT]]></title><description><![CDATA[<p>Ich will wirklich nicht eure &quot;Religiösen-Debatten&quot; stören xDDD<br />
Aber könntet ihr mir vielleicht mal gaaaaaaaaaaaannz kurz helfen ?<br />
Ihr hattet vor einnniiiger Zeit (eben iwann) geschrieben ich solle float etc einfach in bekannte daten typen converten... also wenn ich z.b. ein float in 2 chars speicher... die übertrage (tcp etc) und dann wieder in ein float konvertiere.. is das dann in ordnung ? wegen der byte-order... oder is das nur bei ganzzahlen wichtig ?!</p>
<p>Gruß Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459782</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459782</guid><dc:creator><![CDATA[Foxx90]]></dc:creator><pubDate>Wed, 20 Feb 2008 20:23:42 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 20:42:06 GMT]]></title><description><![CDATA[<p>Du störst doch nicht <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>
<p>Wahrscheinlich soetwas in der Art:</p>
<pre><code class="language-cpp">float value = 1.234f;

if( sizeof( value ) &lt;= sizeof( short ) ) {

    unsigned short *p = reinterpret_cast&lt; unsigned short* &gt;( &amp;value );
    s_value = htons( *p );

} else if( sizeof( value ) &lt;= sizeof( long ) ) {

    unsigned long *p = reinterpret_cast&lt; unsigned long* &gt;( &amp;value );
    l_value = htonl( *p );

} else {

    // Houston, we've got a problem...
}
</code></pre>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459794</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459794</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 20 Feb 2008 20:42:06 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 21:05:49 GMT]]></title><description><![CDATA[<p>ahh ok aber es ist doch nötig wie ich vermutet habe, dass man float auch so handhaben sollte oder ? ich hab neulich in die sfml mal reingeschaut ...<br />
die Klasse Package dort handhabt nur short und int bzw long so ... d.h. mit floats bzw. double wird nichts gemacht.. aber im prinzip sollte man das doch so machen wie du geschrieben hast oder?</p>
<p>Gruß Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459806</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459806</guid><dc:creator><![CDATA[Foxx90]]></dc:creator><pubDate>Wed, 20 Feb 2008 21:05:49 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 21:24:19 GMT]]></title><description><![CDATA[<p>Swordfish schrieb:</p>
<blockquote>
<p>Du störst doch nicht <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>
<p>Wahrscheinlich soetwas in der Art:</p>
<pre><code class="language-cpp">float value = 1.234f;

if( sizeof( value ) &lt;= sizeof( short ) ) {

    unsigned short *p = reinterpret_cast&lt; unsigned short* &gt;( &amp;value );
    s_value = htons( *p );
	
} else if( sizeof( value ) &lt;= sizeof( long ) ) {

    unsigned long *p = reinterpret_cast&lt; unsigned long* &gt;( &amp;value );
    l_value = htonl( *p );

} else {

    // Houston, we've got a problem...
}
</code></pre>
<p>greetz, Swordfish</p>
</blockquote>
<p>Das ist allerdings ziemlich undefiniert. Dann doch lieber:</p>
<pre><code class="language-cpp">float value = 1.234f;
char data[sizeof value];
if ( htonl( 1000 ) == 1000 )
    copy(&amp;reinterpret_cast&lt;const char&amp;&gt;(value),&amp;reinterpret_cast&lt;const char&amp;&gt;(value)+sizeof value,data);
else
    reverse_copy(&amp;reinterpret_cast&lt;const char&amp;&gt;(value),&amp;reinterpret_cast&lt;const char&amp;&gt;(value)+sizeof value,data);
</code></pre>
<p>Das Ergebnis als irgendetwas anderes als einen Haufen von Bytes anzusehen erscheint mir zweifelhaft.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459821</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459821</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 20 Feb 2008 21:24:19 GMT</pubDate></item><item><title><![CDATA[Reply to ntohl usw... on Wed, 20 Feb 2008 21:29:04 GMT]]></title><description><![CDATA[<p>Scheint nicht so einfach zu sein: <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> <a href="http://lists.apple.com/archives/Darwin-dev/2005/Apr//msg00086.html" rel="nofollow">Re: host to network byte order for floats, and float32_t?</a></p>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459827</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459827</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Wed, 20 Feb 2008 21:29:04 GMT</pubDate></item></channel></rss>