<?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[Kurze Frage zur main Funktion]]></title><description><![CDATA[<p>Ai gude,<br />
ich habe mal eine kurze Frage bezüglich der main-Funktion. Warum sollte ich diese eigentlich als int deklarieren und z.B. nicht als short oder gar als float?</p>
<p>Das ist mir gerade durch den Kopf gegangen und ich habe keine richtige Antwort gefunden.</p>
<p>Vielen Dank für eure Hilfe<br />
lg, freakC++</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/249805/kurze-frage-zur-main-funktion</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 08:32:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/249805.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 12 Sep 2009 12:13:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Kurze Frage zur main Funktion on Sat, 12 Sep 2009 12:13:31 GMT]]></title><description><![CDATA[<p>Ai gude,<br />
ich habe mal eine kurze Frage bezüglich der main-Funktion. Warum sollte ich diese eigentlich als int deklarieren und z.B. nicht als short oder gar als float?</p>
<p>Das ist mir gerade durch den Kopf gegangen und ich habe keine richtige Antwort gefunden.</p>
<p>Vielen Dank für eure Hilfe<br />
lg, freakC++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1776957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1776957</guid><dc:creator><![CDATA[freakC++]]></dc:creator><pubDate>Sat, 12 Sep 2009 12:13:31 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zur main Funktion on Sat, 12 Sep 2009 12:18:52 GMT]]></title><description><![CDATA[<p>Das kannst du gerne tun, aber du dann muss ein standardkonformer Compiler deinen Code nicht mehr annehmen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1776963</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1776963</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 12 Sep 2009 12:18:52 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zur main Funktion on Sat, 12 Sep 2009 12:20:25 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ja, mir ist schon klar, dass das eigentlich kein Compiler gerne sieht. Aber ich frage mich <em>warum</em>. Das das mal jemand gesagt oder gibt es wirklich einen schlagkräftigen Grund?</p>
<p>Vielen Dank<br />
lg, freakC++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1776964</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1776964</guid><dc:creator><![CDATA[freakC++]]></dc:creator><pubDate>Sat, 12 Sep 2009 12:20:25 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zur main Funktion on Sat, 12 Sep 2009 12:26:31 GMT]]></title><description><![CDATA[<p>Weil es ja wohl genug ints gibt, um einen Befehlscode zurückzugeben. 58389572394923 verschiede gibt's eher net, 65535 reichen da wohl komplett. -.-</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1776966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1776966</guid><dc:creator><![CDATA[Trottell]]></dc:creator><pubDate>Sat, 12 Sep 2009 12:26:31 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zur main Funktion on Sat, 12 Sep 2009 12:30:57 GMT]]></title><description><![CDATA[<p>[C++ Standard]</p>
<p><strong>3.6.1 Main function</strong><br />
A program shall contain a global function called main, which is the designated start of the program. It is implementationdefined whether a program in a freestanding environment is required to define a main function. [ Note: in a freestanding environment, start-up and termination is implementation-defined; start-up contains the execution of constructors for objects of namespace scope with static storage duration; termination contains the execution of destructors for objects with static storage duration. —end note ]</p>
<p>An implementation shall not predefine the main function. This function shall not be overloaded. It shall have a return type of type int, 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>In the latter form argc shall be the number of arguments passed to the program from the environment in which the program is run. If argc is nonzero these arguments shall be supplied in argv[0] through argv[argc-1] as pointers to<br />
the initial characters of null-terminated multibyte strings (NTMBSs) (17.3.2.1.3.2) and argv[0] shall be the pointer to the initial character of a NTMBS that represents the name used to invoke the program or &quot;&quot;. The value of argc shall be nonnegative. The value of argv[argc] shall be 0. [ Note: it is recommended that any further (optional) parameters be added after argv. —end note ]</p>
<p>The function main shall not be used (3.2) within a program. The linkage (3.5) of main is implementation-defined. A program that declares main to be inline or static is ill-formed. The name main is not otherwise reserved. [ Example:<br />
member functions, classes, and enumerations can be called main, as can entities in other namespaces. —end example ]</p>
<p>[/C++ Standard]</p>
<p>Und der tiefere Sinn dahinter: Der Rückgabewert eines Programmes soll üblicherweise einen Fehlercode darstellen und dieser ist vom Typ int. Du kannst da natürlich auch versuchen, was anderes zurückgeben. Dann musst du aber damit rechnen, dass alle anderen Programme sich an die übliche Konvention halten und deinen Rückgabewert als int-Fehlercode interpretieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1776970</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1776970</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 12 Sep 2009 12:30:57 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zur main Funktion on Sat, 12 Sep 2009 12:49:27 GMT]]></title><description><![CDATA[<p>Ok, also der Standart schreibt es vor. Das wollte ich wissen!</p>
<p>Vielen Dank<br />
lg, freakC++</p>
<p>PS.: Warum wird mein &quot;Standard&quot; zensiert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1776985</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1776985</guid><dc:creator><![CDATA[freakC++]]></dc:creator><pubDate>Sat, 12 Sep 2009 12:49:27 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zur main Funktion on Sat, 12 Sep 2009 12:54:02 GMT]]></title><description><![CDATA[<p>Weil du es wahrscheinlich mit 't' statt mit 'd' am Ende schreibst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1776993</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1776993</guid><dc:creator><![CDATA[KPC]]></dc:creator><pubDate>Sat, 12 Sep 2009 12:54:02 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zur main Funktion on Sat, 12 Sep 2009 13:00:40 GMT]]></title><description><![CDATA[<p>freakC++ schrieb:</p>
<blockquote>
<p>PS.: Warum wird mein &quot;Standard&quot; zensiert?</p>
</blockquote>
<p>Weil das Forum so nett ist, die üblichsten Rechtschreibfehler zu zensieren. Wer hier öfters Texte liest, weiß das zu schätzen.</p>
<p>edit: Ups, das kommt davon wenn man mitten im Satz die Aussage ändern will. Grammatikfehler korrigiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1776995</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1776995</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sat, 12 Sep 2009 13:00:40 GMT</pubDate></item><item><title><![CDATA[Reply to Kurze Frage zur main Funktion on Sat, 12 Sep 2009 12:57:50 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>haha...das wusste ich noch gar nicht!! Find' ich lustig. Jetzt müsste es nur noch die Grammatik verbessern:</p>
<blockquote>
<p>Wer du hier öfters Texte liest, weiß das zu schätzen.</p>
</blockquote>
<p><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>lg, freakC++</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1776997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1776997</guid><dc:creator><![CDATA[freakC++]]></dc:creator><pubDate>Sat, 12 Sep 2009 12:57:50 GMT</pubDate></item></channel></rss>