Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>C89/90 still has the implicit int rule, so <code>main()</code> is equivalent to <code>int main()</code>. By leaving off the return type, you've implicitly defined the return type as <code>int</code>. Some may consider this sloppy, but it's strictly conforming (i.e., involves no implementation defined, undefined or unspecified behavior).</p> <p>For C99, the implicit <code>int</code> rule has been removed, so <code>main()</code> isn't defined. <em>However</em>, a compiler is only required to "issue a diagnostic" upon encountering a violation of a <code>Shall</code> or <code>Shall not</code> clause -- it's still free to continue compiling after issuing the diagnostic. Exactly what constitutes a diagnostic is implementation defined. As such, all that's needed for gcc to conform in this respect is documentation to say that the warning it issues is to be considered a diagnostic.</p> <p>Edit: "implicit <code>int</code>" in the C89/90 standard isn't really a single rule in a single place -- it's spread around in a couple of places. The primary one is §6.5.2.1, where it says:</p> <blockquote> <p>-- <code>int</code>, <code>signed</code>, <code>signed int</code>, or no type specifiers</p> </blockquote> <p>This is part of a list, where all the items on each line of the list are considered equivalent, so this is saying that (unless otherwise prohibited) lack of a type specifier is equivalent to specifying (signed) <code>int</code>.</p> <p>For function parameters, there's a separate specification (at §6.7.1) that: "Any parameter that is not declared has type <code>int</code>."</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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