Mail Archives: djgpp/1997/12/26/14:52:58
At 01:31 12/26/1997 PST, Noam Rotem wrote:
>Hi,
>
>When I'm using the -Wall switch, I get also the warning about
>main, defaulting to 'int'...
>
>Is there anyway (except for using 'int main' of course)
>to get rid of this particular warning when using -Wall? Maybe
>another switch which filters some warnings out?
I don't know of any way. IMHO, people who use `void main' deserve the
warnings. Either don't do that, or ignore them.
Strangely, I can't get the warnings myself. Compiling this program:
#include <stdio.h>
void main(void) { printf("Hello, world"); }
yields no warnings, even with `-Wall' and/or `-W'. I am using GCC 2.7.2.1
recompiled from source with stabs patch.
I investigated this, and found that generating warnings for `main' and
having it return 0 is predicated on a macro called `DEFAULT_MAIN_RETURN'
being defined in c-decl.c of the GCC sources. A `grep' through the entire
tree found no definition of this macro. Therefore, I am confused as to how
anyone can get the `void main' warnings.
Any thoughts welcome
Nate Eldredge
eldredge AT ap DOT net
- Raw text -