<?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[char, signed char]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich arbeite grade etwas mit C++ (komme ursprünglich von C bzw. C89). Nun folgende Frage:<br />
Wieso ist char ungleich signed char? Ist das eine Eigenheit von C++ oder C99? Was ist zu beachten? Ist hier ein Cast (signed char &lt;-&gt; char) erlaubt?</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/176941/char-signed-char</link><generator>RSS for Node</generator><lastBuildDate>Sat, 19 Sep 2026 16:49:56 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/176941.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Mar 2007 15:24:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 15:24:42 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Ich arbeite grade etwas mit C++ (komme ursprünglich von C bzw. C89). Nun folgende Frage:<br />
Wieso ist char ungleich signed char? Ist das eine Eigenheit von C++ oder C99? Was ist zu beachten? Ist hier ein Cast (signed char &lt;-&gt; char) erlaubt?</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253093</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253093</guid><dc:creator><![CDATA[c++ Newbie]]></dc:creator><pubDate>Mon, 26 Mar 2007 15:24:42 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 15:26:05 GMT]]></title><description><![CDATA[<p>In C++ zumindest ist nicht definiert ob 'char' signed oder unsigned ist. Oder irre ich mich da?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253095</guid><dc:creator><![CDATA[Entenwickler]]></dc:creator><pubDate>Mon, 26 Mar 2007 15:26:05 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 17:21:16 GMT]]></title><description><![CDATA[<p>Laut google gibt es bei c++ wirklich drei Typen von char:<br />
char, unsigned char, signed char</p>
<p>Ist aber der einzige Typ, wo signed ungleich &quot;keine Angabe&quot; ist (normalerweise keine Angabe -&gt; signed).</p>
<p>Nun nochmal meine Fragen:<br />
- Inwiefern unterscheidet sich nun char von signed char<br />
- seit wann gibts diese Unterscheidung? (C99? C++? Oder gabs das auch schon bei C89?)<br />
- Darf man signed char &lt;-&gt; char bedenkenlos casten?</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253190</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253190</guid><dc:creator><![CDATA[c++ Newbie]]></dc:creator><pubDate>Mon, 26 Mar 2007 17:21:16 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 17:30:51 GMT]]></title><description><![CDATA[<p>es gibt nur 2, signed char und unsigned char.<br />
wenn man nix davorschreibt (also nur 'char') ist es implementationsspezifisch, ob 'signed' oder 'unsigned' genommen wird.<br />
signed char ist immer vorzeichenbehaftet, die eine hälfte des wertebereichs ist negativ.<br />
unsigned char kann nur positive werte, dafür aber doppelt so viele wie 'signed'.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253199</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253199</guid><dc:creator><![CDATA[vista]]></dc:creator><pubDate>Mon, 26 Mar 2007 17:30:51 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:03:28 GMT]]></title><description><![CDATA[<p>bin mir nicht 100%ig sicher ... aber sollte laut std. signed sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253233</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253233</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:03:28 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:07:27 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Konnte ich leider nicht nachvollziehen:</p>
<pre><code class="language-cpp">void testFunction (const char* textPointer);

const char text1[]=(&quot;Text1&quot;);
const signed text2[]=(&quot;Text2&quot;);
const unsigned char text3[]=(&quot;Text3&quot;);

testFunction (text1);  // compiliert problemlos
testFunction (text2);  // invalid conversion ...
testFunction (text3);  // invalid conversion ...
</code></pre>
<p>Getestet mit g++ unter Ubuntu.<br />
Müsste denn dann nicht test2 oder text3 ohne Fehlermeldung compilieren wenn char = unsigned char bzw. char = signed char?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253239</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253239</guid><dc:creator><![CDATA[c++ Newbie]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:07:27 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:08:39 GMT]]></title><description><![CDATA[<p>soll natürlich</p>
<pre><code class="language-cpp">const signed char
</code></pre>
<p>heißen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253240</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253240</guid><dc:creator><![CDATA[c++ Newbie]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:08:39 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:10:23 GMT]]></title><description><![CDATA[<blockquote>
<p>Plain char, signed char, and unsigned char are <strong>three distinct types</strong>. A char, a signed char, and an unsigned char occupy the same amount of storage and have the same alignment requirements (3.9); that is, they have the same object representation. For character types, all bits of the object representation participate in the value representation. For unsigned character types, all possible bit patterns of the value representation represent numbers. These requirements do not hold for other types.<br />
In any particular implementation, a <strong>plain char object can take on either the same values as a signed char or an unsigned char; which one is implementationdefined</strong>.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1253242</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253242</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:10:23 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:11:20 GMT]]></title><description><![CDATA[<p>c++ Newbie schrieb:</p>
<blockquote>
<p>Müsste denn dann nicht test2 oder text3 ohne Fehlermeldung compilieren wenn char = unsigned char bzw. char = signed char?</p>
</blockquote>
<p>Ja müsste. Es gibt entgegen anderslautendem Halbwissen in diesem Thread tatsächlich 3 verschiedene char-Typen. Warum das so ist, das kann ich dir allerdings auch nicht beantworten <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253243</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:11:20 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:33:33 GMT]]></title><description><![CDATA[<p>Bashar schrieb:</p>
<blockquote>
<p>Es gibt entgegen anderslautendem Halbwissen in diesem Thread tatsächlich 3 verschiedene char-Typen.</p>
</blockquote>
<p>welcher ist denn der dritte typ?<br />
'half-signed' ? <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/1253262</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253262</guid><dc:creator><![CDATA[vista]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:33:33 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:38:04 GMT]]></title><description><![CDATA[<p>vista schrieb:</p>
<blockquote>
<p>welcher ist denn der dritte typ?</p>
</blockquote>
<p>char.<br />
Hast den Rest des Threads wohl nicht gelesen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253265</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:38:04 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:45:04 GMT]]></title><description><![CDATA[<p>MFK schrieb:</p>
<blockquote>
<p>vista schrieb:</p>
<blockquote>
<p>welcher ist denn der dritte typ?</p>
</blockquote>
<p>char.<br />
Hast den Rest des Threads wohl nicht gelesen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
</blockquote>
<p>doch, aber das funktioniert ungefähr so:<br />
man hat die wahl zwischen 'char', 'signed char' und 'unsigned char'.<br />
d.h. man kann sich für eine von 3 möglichkeiten entscheiden,<br />
signed char -&gt; ist garantiert signed<br />
unsigned char -&gt; ist garantiert unsigned<br />
char -&gt; ist entweder das eine oder das andere<br />
- aber -<br />
<strong>es gibt nur 2 char-typen</strong>, bei 'nur char' lässt man dem compiler die wahl, das ist der einzige unterschied, kein 'teilweise sigend' oder sowas...<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253275</guid><dc:creator><![CDATA[vista]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:45:04 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:47:35 GMT]]></title><description><![CDATA[<p>vista schrieb:</p>
<blockquote>
<p>doch, aber das funktioniert ungefähr so:[...]<br />
char -&gt; ist entweder das eine oder das andere</p>
</blockquote>
<p>Nein, char hat entweder den Wertebereich von signed oder von unsigned char, ist aber immer ein eigenständiger Typ. Es wurde dazu auch schon alles gesagt, inklusive Code-Beispiel und Zitat aus dem Standard, was willst du noch?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253279</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253279</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:47:35 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 18:51:59 GMT]]></title><description><![CDATA[<p>Bashar schrieb:</p>
<blockquote>
<p>Nein, char hat entweder den Wertebereich von signed oder von unsigned char, ist aber immer ein eigenständiger Typ.</p>
</blockquote>
<p>stimmt, so gesehen hast du natürlich recht (ich hatte das codebeispiel übersehen).<br />
ist das in C etwa auch so oder ist das eine C++ spezialität?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253281</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253281</guid><dc:creator><![CDATA[vista]]></dc:creator><pubDate>Mon, 26 Mar 2007 18:51:59 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 19:10:23 GMT]]></title><description><![CDATA[<p>Ist in C genauso</p>
<p>meinten jedenfalls dir Gurus in der Linux kernel mailinglist</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253295</guid><dc:creator><![CDATA[darthdespotism]]></dc:creator><pubDate>Mon, 26 Mar 2007 19:10:23 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 19:16:16 GMT]]></title><description><![CDATA[<p>Es dürfte aber in C etwas weniger Probleme damit geben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253301</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253301</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 26 Mar 2007 19:16:16 GMT</pubDate></item><item><title><![CDATA[Reply to char, signed char on Mon, 26 Mar 2007 22:25:45 GMT]]></title><description><![CDATA[<p>Hm und wie geht man mit char am besten um? Bleibt einem dann nur übrig auch char zu verwenden? Oder einfach casten? Viele Bibliotheksfunktion verwenden ja nur char (kein signed oder unsigned char).<br />
Grund der Frage: verwende gerne die uintX_t und intX_t typedefs von gcc bzw. g++. Da hab ich leider kein char und wollte jetzt auch net unbedingt char verwenden <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1253428</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1253428</guid><dc:creator><![CDATA[c++ Newbie]]></dc:creator><pubDate>Mon, 26 Mar 2007 22:25:45 GMT</pubDate></item></channel></rss>