{"id":4140,"date":"2014-03-30T08:07:22","date_gmt":"2014-03-30T08:07:22","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/mains-signature-in-c-collection-of-common-programming-errors\/"},"modified":"2014-03-30T08:07:22","modified_gmt":"2014-03-30T08:07:22","slug":"mains-signature-in-c-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/mains-signature-in-c-collection-of-common-programming-errors\/","title":{"rendered":"Main&#39;s Signature in C++-Collection of common programming errors"},"content":{"rendered":"<p>The standard explicitly states that <code>main<\/code> has two valid (i.e., guaranteed to work) signatures; namely:<\/p>\n<pre><code>int main();\nint main(int, char*[]);\n<\/code><\/pre>\n<p>My question is simple, would something like the following be legal?<\/p>\n<pre><code>int main(const unsigned int, const char* const* argv);\n<\/code><\/pre>\n<p>My tests say &#8216;yes&#8217;, but I&#8217;m unsure of the answer because am I not overloading <code>main<\/code> by changing <code>int<\/code> to <code>unsigned int<\/code> as well as the non top-level <code>const<\/code>-ness of argv? If I am, then that&#8217;s clearly prohibited.<\/p>\n<p>So, are these modifications guaranteed to work on a standards conforming compiler?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The standard explicitly states that main has two valid (i.e., guaranteed to work) signatures; namely: int main(); int main(int, char*[]); My question is simple, would something like the following be legal? int main(const unsigned int, const char* const* argv); My tests say &#8216;yes&#8217;, but I&#8217;m unsure of the answer because am I not overloading main [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4140","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4140"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4140\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}