Mail Archives: djgpp/1999/05/23/20:01:21
> After some discussion in es.lenguajes.c and es.lenguajes.c++ (spanish
> newsgroup discussing c and c++ languajes), many people say that
> according to the ISO standard, void main() is not incorrect, but
> implementation dependent. That is, it is not portable, yet it is
> allowed by the standard if the compiler chooses to support it.
>
> What do you think?
DJGPP's runtime code will *use* the return value of main(), so it had
better return one.
If it is "implementation defined", then for the djgpp implementation,
I define it as returning "int", even if gcc allows otherwise.
My reference says that main returns "int" but if the *value* is
undefined (i.e. it falls off the end of main without an explicit
return), the value that is chosen as the return value is
implementation-dependent.
- Raw text -