Mail Archives: djgpp/1997/05/18/21:32:13
George Foot (mert0407 AT sable DOT ox DOT ac DOT uk) wrote:
> John M. Aldrich (fighteer AT cs DOT com) wrote:
> : And, of course, add a "return 0;" at the end of main().
> Is this strictly necessary? I was glancing through the ANSI standard the
> other day (as one does) and it said that if main() reaches the end of the
> function without encountering a return statement, it should assume a
> return value of 0. Now gcc complains about this; is this non-compliance?
No; gcc is only absolutely, 100% ANSI when used with the '-ansi' switch.
('-pedantic' will complain about more things but I'm not totally sure if
it enforces more ANSI compliance.)
> I still think it's a good idea to put a return in anyway, for the same
> reason I prototype all my functions and assign them return types.
Right. It's a good stylistic habit to have.
--
Jason Daniels -- bd733 AT rgfn DOT epcc DOT edu
Linux: The choice of a GNU generation.
Winblows 95: The world's best-selling computer virus.
- Raw text -