<?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[malloc Allozierung geht verloren]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>für folgendes habe ich keine Antwort:</p>
<p>Innerhalb einer Funktion alloziere ich Speicher für Array, dass N Strukturen aufnehmen soll. Diese fülle ich. Am Ende der Funktion sind diese auch noch verfügbar. Über einen Pointer möchte ich dieses array auch a0ßerhalb de Funktion nutzen. Jedoch nach Verlassen der Funktion ist dieses array nicht mehr verfügbar.</p>
<p>Folgendes Beispiel zeigt was ich tue. Der Speicher wird in der Funktion NICHT durch free() freigegben</p>
<pre><code class="language-cpp">struct tim
{ 
   int a;
   int b;
};

void fun(tim* t)
{
//...
   t = (tim*)malloc(sizeof(tim)*N)

// FÜLLEN

// HIER komplett verfügbar
}

void main()
{
   tim * r;
   fun(r);

   // r nicht mehr verfügbar!!!

}
</code></pre>
<p>Danke für Eure Hilfe!</p>
<p>Peter</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/267708/malloc-allozierung-geht-verloren</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 07:01:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/267708.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 28 May 2010 17:34:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 17:34:19 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>für folgendes habe ich keine Antwort:</p>
<p>Innerhalb einer Funktion alloziere ich Speicher für Array, dass N Strukturen aufnehmen soll. Diese fülle ich. Am Ende der Funktion sind diese auch noch verfügbar. Über einen Pointer möchte ich dieses array auch a0ßerhalb de Funktion nutzen. Jedoch nach Verlassen der Funktion ist dieses array nicht mehr verfügbar.</p>
<p>Folgendes Beispiel zeigt was ich tue. Der Speicher wird in der Funktion NICHT durch free() freigegben</p>
<pre><code class="language-cpp">struct tim
{ 
   int a;
   int b;
};

void fun(tim* t)
{
//...
   t = (tim*)malloc(sizeof(tim)*N)

// FÜLLEN

// HIER komplett verfügbar
}

void main()
{
   tim * r;
   fun(r);

   // r nicht mehr verfügbar!!!

}
</code></pre>
<p>Danke für Eure Hilfe!</p>
<p>Peter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903846</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903846</guid><dc:creator><![CDATA[haller.peter]]></dc:creator><pubDate>Fri, 28 May 2010 17:34:19 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 17:43:10 GMT]]></title><description><![CDATA[<p>edit: Ach, habe übersehen, dass du den Pointer als Kopie übergeben hast. Vergiss was hier stand.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903849</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903849</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Fri, 28 May 2010 17:43:10 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 17:39:56 GMT]]></title><description><![CDATA[<p>Das liegt daran das der Pointer kopiert wird und dann nur der Kopie der Speicherbereich zugewiesen wird. Am ende der Methode wird die Kopie gelöscht und damit auch der Verweis auf deinen Speicher.</p>
<p>Probier mal das:</p>
<pre><code class="language-cpp">struct tim 
{ 
   int a; 
   int b; 
}; 

void fun(tim** t) 
{ 
//... 
   *t = (tim*)malloc(sizeof(tim)*N) 

// FÜLLEN 

// HIER komplett verfügbar 
} 

void main() 
{ 
   tim * r; 
   fun(&amp;r); 

   // r nicht mehr verfügbar!!! 

}
</code></pre>
<p>Viele Grüße</p>
<p>Andreas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903850</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903850</guid><dc:creator><![CDATA[Andy_L]]></dc:creator><pubDate>Fri, 28 May 2010 17:39:56 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 17:40:55 GMT]]></title><description><![CDATA[<p>Du kannst eine Referenz auf den Zeiger übergeben, damit dieser geändert wird:</p>
<pre><code class="language-cpp">void fun(tim*&amp; t)
</code></pre>
<p>Ebenfalls geht ein Zeiger auf einen Zeiger, wobei du dann die Zugriffssyntax ändern musst (eine zusätzliche Dereferenzierung).</p>
<pre><code class="language-cpp">void fun(tim** t)
</code></pre>
<p>Übrigens muss die <code>main()</code> -Funktion sowohl in C als auch in C++ den Rückgabetyp <code>int</code> und nicht <code>void</code> haben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903851</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903851</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Fri, 28 May 2010 17:40:55 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 17:50:57 GMT]]></title><description><![CDATA[<p>Doppelter Zeiger war die Lösung.</p>
<p>Wenn ich kein Betriebssystem habe, darf main auch void sein <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>
<p>Danke Euch!</p>
<p>Grüße,<br />
Peter</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903856</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903856</guid><dc:creator><![CDATA[haller.peter]]></dc:creator><pubDate>Fri, 28 May 2010 17:50:57 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 17:53:09 GMT]]></title><description><![CDATA[<p>haller.peter schrieb:</p>
<blockquote>
<p>Wenn ich kein Betriebssystem habe, darf main auch void sein <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>Nein, darf es nicht. Auch dann muss es int sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903858</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903858</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Fri, 28 May 2010 17:53:09 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 18:20:20 GMT]]></title><description><![CDATA[<p>Was hat dann der Rückgabewert für einen Sinn?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903872</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903872</guid><dc:creator><![CDATA[haller.peter]]></dc:creator><pubDate>Fri, 28 May 2010 18:20:20 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 18:26:58 GMT]]></title><description><![CDATA[<p>haller.peter schrieb:</p>
<blockquote>
<p>Was hat dann der Rückgabewert für einen Sinn?</p>
</blockquote>
<p>Es ist <strong>im Standard so definiert</strong>, damit das Betriebssystem über den Status des Programms bescheid weiß. Ja, man geht tatsächlich davon aus, dass es ein Betriebssystem gibt! Unglaublich, oder? <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/1903873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903873</guid><dc:creator><![CDATA[...]]></dc:creator><pubDate>Fri, 28 May 2010 18:26:58 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 18:33:39 GMT]]></title><description><![CDATA[<p>Es gibt aber auch Systeme, die ohne Betriebssystem laufen, z.B. einige Microcontroller. Da macht der Rückgabewert keinen Sinn. Oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903874</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903874</guid><dc:creator><![CDATA[haller.peter]]></dc:creator><pubDate>Fri, 28 May 2010 18:33:39 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 18:36:23 GMT]]></title><description><![CDATA[<p>wenn man void macht, geht was kapudd?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903875</guid><dc:creator><![CDATA[waslos]]></dc:creator><pubDate>Fri, 28 May 2010 18:36:23 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 18:41:06 GMT]]></title><description><![CDATA[<p>nein, natürlich nciht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903877</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903877</guid><dc:creator><![CDATA[haller.peter]]></dc:creator><pubDate>Fri, 28 May 2010 18:41:06 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 18:42:18 GMT]]></title><description><![CDATA[<p>Doch, der Computer kann explodieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903878</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903878</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Fri, 28 May 2010 18:42:18 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 20:28:47 GMT]]></title><description><![CDATA[<p>waslos schrieb:</p>
<blockquote>
<p>wenn man void macht, geht was kapudd?</p>
</blockquote>
<p>Ja, das ganze kompiliert nämlich nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903904</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903904</guid><dc:creator><![CDATA[Athar]]></dc:creator><pubDate>Fri, 28 May 2010 20:28:47 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Fri, 28 May 2010 20:58:19 GMT]]></title><description><![CDATA[<p>haller.peter schrieb:</p>
<blockquote>
<p>Es gibt aber auch Systeme, die ohne Betriebssystem laufen, z.B. einige Microcontroller. Da macht der Rückgabewert keinen Sinn. Oder?</p>
</blockquote>
<p>Sinn machen kann es so und so nicht - wenn überhaupt kann es Sinn ergeben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue"
      title=":P"
      alt="😛"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903905</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903905</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Fri, 28 May 2010 20:58:19 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sat, 29 May 2010 01:06:26 GMT]]></title><description><![CDATA[<p>Athar schrieb:</p>
<blockquote>
<p>Ja, das ganze kompiliert nämlich nicht.</p>
</blockquote>
<p>Bei mir schon.</p>
<p>Und ja, es kann was kaputt gehen! Die Gatter können durchbrennen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903960</guid><dc:creator><![CDATA[Seriously]]></dc:creator><pubDate>Sat, 29 May 2010 01:06:26 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sat, 29 May 2010 22:48:16 GMT]]></title><description><![CDATA[<p>Seriously schrieb:</p>
<blockquote>
<p>Athar schrieb:</p>
<blockquote>
<p>Ja, das ganze kompiliert nämlich nicht.</p>
</blockquote>
<p>Bei mir schon.</p>
<p>Und ja, es kann was kaputt gehen! Die Gatter können durchbrennen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /></p>
</blockquote>
<p>Das einzige, was hier kaputt geht, ist die Geduld der Forumsteilnehmer <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/1904326</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904326</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Sat, 29 May 2010 22:48:16 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sat, 29 May 2010 23:02:27 GMT]]></title><description><![CDATA[<p>unskilled schrieb:</p>
<blockquote>
<p>Sinn machen kann es so und so nicht - wenn überhaupt kann es Sinn ergeben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue"
      title=":P"
      alt="😛"
    /></p>
</blockquote>
<p>Blödsinn. Seit ich von Lessing (18. Jahrhundert) diese Formulierung gesehen habe, glaube ich nicht mehr an das Märchen vom neuen bösen Anglizismus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904331</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904331</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sat, 29 May 2010 23:02:27 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sat, 29 May 2010 23:40:07 GMT]]></title><description><![CDATA[<p>Wie dem auch sei, im C++-Standard ist explizit festgehalten, dass main einen int zurückgeben <em>muss</em>.</p>
<p>ISO/IEC 14882:2003 3.6.1 (2) schrieb:</p>
<blockquote>
<p>An implementation shall not predefine the main function. This function shall not be overloaded. <strong>It shall have a return type of type int</strong>, but otherwise its type is implementation-defined. All implementations shall allow both of the following definitions of main:</p>
<pre><code class="language-cpp">int main() { /* ... */ }
</code></pre>
<p>and</p>
<pre><code class="language-cpp">int main(int argc, char* argv[]) { /* ... */ }
</code></pre>
<p>(... es folgt eine Beschreibung von argc und argv ...)</p>
</blockquote>
<p>Von Rechts wegen darf ein C++-Compiler &quot;void main&quot; nicht akzeptieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904335</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904335</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Sat, 29 May 2010 23:40:07 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sun, 30 May 2010 06:43:48 GMT]]></title><description><![CDATA[<p>seldon schrieb:</p>
<blockquote>
<p>Wie dem auch sei, im C++-Standard ist explizit festgehalten, dass main einen int zurückgeben <em>muss</em>.</p>
<p>ISO/IEC 14882:2003 3.6.1 (2) schrieb:</p>
<blockquote>
<p>An implementation shall not predefine the main function. This function shall not be overloaded. <strong>It shall have a return type of type int</strong>, but otherwise its type is implementation-defined. All implementations shall allow both of the following definitions of main:</p>
<pre><code class="language-cpp">int main() { /* ... */ }
</code></pre>
<p>and</p>
<pre><code class="language-cpp">int main(int argc, char* argv[]) { /* ... */ }
</code></pre>
<p>(... es folgt eine Beschreibung von argc und argv ...)</p>
</blockquote>
<p>Von Rechts wegen darf ein C++-Compiler &quot;void main&quot; nicht akzeptieren.</p>
</blockquote>
<p>Ich kann nicht so gut Englisch. aber sagt &quot;but otherwise its type is implementation-defined&quot; nicht genau das Gegenteil, also daß sehr wohl anderes gemacht werden darf, aber dann die Sache halt implementation-defined wird?<br />
Also kein absolutes void-Verbot mehr und kein Kreuzzug und keine Heilige Inquisition, wenn das jemand geschrieben hat?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904354</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904354</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sun, 30 May 2010 06:43:48 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sun, 30 May 2010 07:35:32 GMT]]></title><description><![CDATA[<p>Frage: Warum in C++ malloc und nicht new?</p>
<p>Zu</p>
<pre><code class="language-cpp">int main() { /* ... */ }
</code></pre>
<p>ist das ja in einigen Compilern so umgesetzt, das das normalerweise folgende:</p>
<pre><code class="language-cpp">return
</code></pre>
<p>entfallen kann, da der Compiler in dem Fall weiss was er machen sollte.</p>
<p>Dann steht alle Implementationen sollten folgendem Muster folgen:</p>
<pre><code class="language-cpp">int main() { /* ... */ }
</code></pre>
<p>So weit meine recht freie Interpretation <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>
<p>Wie schrieb Volkard: Komma können Leben retten <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>MfG f.-th.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904362</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904362</guid><dc:creator><![CDATA[f.-th.]]></dc:creator><pubDate>Sun, 30 May 2010 07:35:32 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sun, 30 May 2010 07:40:13 GMT]]></title><description><![CDATA[<p>Okay Satzzeichen und eventuelle Missinterpretationen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /> <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>Mit &quot;in dem Fall&quot; ist gemeint, wenn nicht ein anderer Rückgabewert des Programms von der Umgebung gefordert ist.</p>
<p>Hoffe nun sind alle Klarheiten beseitigt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904363</guid><dc:creator><![CDATA[f.-th.]]></dc:creator><pubDate>Sun, 30 May 2010 07:40:13 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sun, 30 May 2010 08:41:41 GMT]]></title><description><![CDATA[<p>volkard schrieb:</p>
<blockquote>
<p>Ich kann nicht so gut Englisch. aber sagt &quot;but otherwise its type is implementation-defined&quot; nicht genau das Gegenteil, also daß sehr wohl anderes gemacht werden darf, aber dann die Sache halt implementation-defined wird?</p>
</blockquote>
<p>Bin auch kein Englisch-Master, aber meiner Auffassung nach steht da, dass die main-Funktion int zurückgeben <em>muss</em>, aber darüber hinaus ihr Typ von einer konkreten Implementation vorgegeben werden kann. Das ist die Lesart für &quot;shall&quot;, die bei technischen Spezifikationen wie z. B. RFCs gilt.</p>
<p>[was hier stand war Unsinn und steht deshalb jetzt nicht mehr hier]</p>
<blockquote>
<p>Also kein absolutes void-Verbot mehr und kein Kreuzzug und keine Heilige Inquisition, wenn das jemand geschrieben hat?</p>
</blockquote>
<p>Statt dessen Folterung und langsamer Tod.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904366</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904366</guid><dc:creator><![CDATA[Nukularfüsiker]]></dc:creator><pubDate>Sun, 30 May 2010 08:41:41 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sun, 30 May 2010 08:21:56 GMT]]></title><description><![CDATA[<p>&quot;but otherwise&quot; == &quot;aber ansonsten&quot;.</p>
<p>Das heißt, main muss int zurückgeben, aber welche Parameter sie entgegennehmen kann, ist implementationsabhängig - es müssen halt nur mindestens die beiden angegebenen unterstützt werden.</p>
<p>Beispielsweise findet man häufig die dritte Form</p>
<pre><code class="language-cpp">int main(int argc, char *argv[], char *envp[]);
</code></pre>
<p>in der ein Array von Umgebungsvariablen als envp mitgegeben wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904372</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904372</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Sun, 30 May 2010 08:21:56 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sun, 30 May 2010 09:46:54 GMT]]></title><description><![CDATA[<p>volkard schrieb:</p>
<blockquote>
<p>ISO/IEC 14882:2003 3.6.1 (2) schrieb:</p>
<blockquote>
<p>An implementation shall not predefine the main function. This function shall not be overloaded. <strong>It shall have a return type of type int</strong>, but otherwise its type is implementation-defined.</p>
</blockquote>
<p>Ich kann nicht so gut Englisch. aber sagt &quot;but otherwise its type is implementation-defined&quot; nicht genau das Gegenteil, also daß sehr wohl anderes gemacht werden darf, aber dann die Sache halt implementation-defined wird?</p>
</blockquote>
<p>Ich verstehe den Satz so, dass sich &quot;its type&quot; auf den Typ der Funktion bezieht, also bezeichnet &quot;otherwise its type&quot; den Funktionstyp ohne Rückgabetyp, was den Parametern entspricht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904396</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 30 May 2010 09:46:54 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sun, 30 May 2010 10:04:47 GMT]]></title><description><![CDATA[<p>Ja, klingt logisch.<br />
Aber die hätten ruhig netter sein können und statt zu schreiben<br />
&quot;Der Rückgabetyp muß int sein, aber ansonsten ist der Typ durch die Implementierung definiert.&quot;<br />
lieber<br />
&quot;Der Rückgabetyp muß int sein und die Parameter sind durch die Implementierung definiert.&quot;<br />
So lerne ich nie C++. <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/1904399</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904399</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Sun, 30 May 2010 10:04:47 GMT</pubDate></item><item><title><![CDATA[Reply to malloc Allozierung geht verloren on Sun, 30 May 2010 10:46:17 GMT]]></title><description><![CDATA[<p>Die Stelle ist wirklich sehr ungeschickt forumuliert. Da hätten 2 getrennte Sätze einiges an Konfusion vermeiden können.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904408</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 30 May 2010 10:46:17 GMT</pubDate></item></channel></rss>