Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>GCC knows about the contents of the standard headers even when you don't include them, and complains when the implied (or inferred) declaration of the function isn't sufficiently the same as what it would be if the header is included.</p> <p>By inference, the type of <code>exit()</code> is:</p> <pre><code>extern int exit(); // Indeterminate argument list </code></pre> <p>This is not the same as the official declaration:</p> <pre><code>extern void exit(int); </code></pre> <p>Hence the warning. Get used to it; fix the code.</p> <hr> <p>[The weasel word 'sufficiently' is there because this code compiles without warning when the declaration of <code>exit()</code> is not commented out, but generates the warning when it is missing.</p> <pre><code>extern void exit(); int main(int argc, char **argv) { if (argc &gt; 1 &amp;&amp; argv[0] != 0) exit(1); return(0); } </code></pre> <p>End of weasel words.]</p> <hr> <p>Note: pre-standard C heavily used implicit function declarations. C89 started to encourage the use of proper definitions, in part by ensuring that every standard function had a header that declared it. (POSIX helped too by ensuring that all the functions it defines are declared in a header.) C99 moved one step further by saying that the pre-standard and C89 'implicit int' interpretation of functions was no longer valid. GCC is now helping you get around to fixing your code by identifying the functions. You can use the options:</p> <pre><code>-Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition </code></pre> <p>to help you catch the problems if (like me) you work on antiquated code bases that have not been overhauled to modern C coding standards.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload