<?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[typedef-Frage]]></title><description><![CDATA[<pre><code>typedef char string[20];

inline void formatstring(char *d, const char *fmt, va_list v) { ... }
</code></pre>
<p>Was macht das denn für einen Sinn? Zunächst einmal wird ein string[20] hier als alias für einen char benutzt, sofern ich mich nicht irre.<br />
Dann steht da also</p>
<p>inline void formatstring(string[20] *d, ...)</p>
<p>Aber string[20] *d ergibt doch keinen Sinn, wenn dann müsste das doch string[20] d heißen oder wird das typedef irgendwie wieder aufgehoben?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/216481/typedef-frage</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 06:53:32 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/216481.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 24 Jun 2008 15:19:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to typedef-Frage on Tue, 24 Jun 2008 15:19:19 GMT]]></title><description><![CDATA[<pre><code>typedef char string[20];

inline void formatstring(char *d, const char *fmt, va_list v) { ... }
</code></pre>
<p>Was macht das denn für einen Sinn? Zunächst einmal wird ein string[20] hier als alias für einen char benutzt, sofern ich mich nicht irre.<br />
Dann steht da also</p>
<p>inline void formatstring(string[20] *d, ...)</p>
<p>Aber string[20] *d ergibt doch keinen Sinn, wenn dann müsste das doch string[20] d heißen oder wird das typedef irgendwie wieder aufgehoben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1534893</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1534893</guid><dc:creator><![CDATA[banshee]]></dc:creator><pubDate>Tue, 24 Jun 2008 15:19:19 GMT</pubDate></item><item><title><![CDATA[Reply to typedef-Frage on Tue, 24 Jun 2008 15:24:46 GMT]]></title><description><![CDATA[<p>Zunächst mal wird hier string als Alias für char[20] angelegt. In der folgenden Zeile wird string garnicht benutzt, hat also auch keine Auswirkung auf deren Bedeutung. Meintest Du etwas anderes?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1534901</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1534901</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Tue, 24 Jun 2008 15:24:46 GMT</pubDate></item><item><title><![CDATA[Reply to typedef-Frage on Tue, 24 Jun 2008 15:25:22 GMT]]></title><description><![CDATA[<p>banshee schrieb:</p>
<blockquote>
<pre><code>typedef char string[20];

inline void formatstring(char *d, const char *fmt, va_list v) { ... }
</code></pre>
</blockquote>
<p>Hier hat das typedef garnichts mit der Funktion formatstring zu tun. Nicht char wird ersetzt sondern der Ausdruck string (durch char[20]). Und string sehe ich hier garnicht (zumal ich dieses Typedef unter C++ als sehr problematisch ansehe... Ich sag nur std::string).</p>
<p>cu André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1534902</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1534902</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Tue, 24 Jun 2008 15:25:22 GMT</pubDate></item><item><title><![CDATA[Reply to typedef-Frage on Tue, 24 Jun 2008 22:40:35 GMT]]></title><description><![CDATA[<p>Schau mal <a href="http://www.cpp-tutor.de/cpp/le08/le08_01.htm" rel="nofollow">hier</a> nach.</p>
<p>Ansonsten richte dich hiernach:<br />
typedef Datentyp Synonym;</p>
<p>Was auf der Seite nicht erwähnt wird, dass du typedefs auch im Zusammenhang<br />
mit struct nutzen kannst (struct = Datentyp)</p>
<p>Beispiel Listenknoten (einfach verketteter Listen):</p>
<pre><code class="language-cpp">typedef struct knotenstruktur
{
    int Daten;
    knotenstruktur *Nachfolger;
}Knoten;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1535204</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1535204</guid><dc:creator><![CDATA[Quellcode]]></dc:creator><pubDate>Tue, 24 Jun 2008 22:40:35 GMT</pubDate></item><item><title><![CDATA[Reply to typedef-Frage on Wed, 25 Jun 2008 03:53:52 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">typedef char string[20];
</code></pre>
<p>nun hast du ein neuer typ &quot;string&quot; welcher ein charfeld mit 20 zeichen repräsentiert.</p>
<pre><code class="language-cpp">string a;
string b;
</code></pre>
<p>a und b sind jetzt jeweils char[20] felder...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1535224</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1535224</guid><dc:creator><![CDATA[BorisDieKlinge]]></dc:creator><pubDate>Wed, 25 Jun 2008 03:53:52 GMT</pubDate></item><item><title><![CDATA[Reply to typedef-Frage on Wed, 25 Jun 2008 09:38:36 GMT]]></title><description><![CDATA[<p>Dieser typedef zeigt mal wieder die Sinnhaftigkeit von Namespaces auf. <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/1535372</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1535372</guid><dc:creator><![CDATA[Braunstein (off)]]></dc:creator><pubDate>Wed, 25 Jun 2008 09:38:36 GMT</pubDate></item><item><title><![CDATA[Reply to typedef-Frage on Thu, 26 Jun 2008 09:18:08 GMT]]></title><description><![CDATA[<p>okay vielen Dank soweit <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>
<p>Ich hab mich da etwas verwirren lassen, normalerweise weiß ich, wie ein typedef funktioniert, aber so eins ist mir noch nie untergekommen. Hat das denn einen tieferen Sinn, dass man einen string als char[20] auf diese Weise belegt? Ich fände typedef char[20] string viel logischer.</p>
<p>Und nochmal was anderes: Es gibt ja im Internet Massen an schlechtem Code. Gibts da irgendwie Lesematerial, wie man so schlechten Code in guten, effizienten übersetzt, bzw. was guter Code überhaupt ist? <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/1536134</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1536134</guid><dc:creator><![CDATA[banshee]]></dc:creator><pubDate>Thu, 26 Jun 2008 09:18:08 GMT</pubDate></item><item><title><![CDATA[Reply to typedef-Frage on Thu, 26 Jun 2008 09:21:29 GMT]]></title><description><![CDATA[<p>banshee schrieb:</p>
<blockquote>
<p>Ich hab mich da etwas verwirren lassen, normalerweise weiß ich, wie ein typedef funktioniert, aber so eins ist mir noch nie untergekommen. Hat das denn einen tieferen Sinn, dass man einen string als char[20] auf diese Weise belegt? Ich fände typedef char[20] string viel logischer.</p>
</blockquote>
<p>Wie deklarierst du Variablen?</p>
<pre><code class="language-cpp">char text[20];
// Nun schau auf die Syntax von typedef:
typedef char string[20];
</code></pre>
<p>Fällt dir was auf? Die typedef-Syntax ist identisch mit der Variablendeklaration. Ja, man kann darüber stolpern, wenn man dies aber einmal verstanden hat ist es sogar konsistenter und leichter als 2 verschiedene Fälle in C++ einzubauen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1536138</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1536138</guid><dc:creator><![CDATA[asc]]></dc:creator><pubDate>Thu, 26 Jun 2008 09:21:29 GMT</pubDate></item><item><title><![CDATA[Reply to typedef-Frage on Thu, 26 Jun 2008 10:40:44 GMT]]></title><description><![CDATA[<p>Naja,</p>
<p>ich könnte auch verstehen, wenn man</p>
<pre><code class="language-cpp">char[20] text;
</code></pre>
<p>für sprechender hielte.</p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1536215</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1536215</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Thu, 26 Jun 2008 10:40:44 GMT</pubDate></item><item><title><![CDATA[Reply to typedef-Frage on Thu, 26 Jun 2008 11:22:58 GMT]]></title><description><![CDATA[<p>asc schrieb:</p>
<blockquote>
<p>Fällt dir was auf? Die typedef-Syntax ist identisch mit der Variablendeklaration. Ja, man kann darüber stolpern, wenn man dies aber einmal verstanden hat ist es sogar konsistenter und leichter als 2 verschiedene Fälle in C++ einzubauen.</p>
</blockquote>
<p>Ja das stimmt auch wieder. Witzigerweise machen wir gerade Java an der UNI, was mich jetzt nur noch mehr verwirrt.</p>
<p>Ist schon doof, wenn man in eclipse C/C++ syntax schreibt und in Visual Studio Java Code und sich wundert, wenn nix funktioniert -.-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1536256</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1536256</guid><dc:creator><![CDATA[banshee]]></dc:creator><pubDate>Thu, 26 Jun 2008 11:22:58 GMT</pubDate></item></channel></rss>