Mail Archives: djgpp/1997/10/30/15:16:05
In article <34568B58 DOT 7B61 AT swcp DOT com>
"H.W. Stockman" <hwstock AT swcp DOT com> wrote:
> Vik Heyndrickx wrote:
>>
>> Jon Seanor wrote:
>> >
>> > >And the return type of main is int, not void. That should be in any text
>> > >book too.
>> >
>> > Only if you want to return something!
>>
>> The standard tells that the return type of main is int and not void.
>
> Many compilers will gleefully let you declare
> void main(){}
> ...without a single complaint. However, the consequences
> of mixing order of argc and argv[] are likely to be
> more significant.
Actually, if you use the -Wall switch when compiling it tells you:
warning: return type for `main' changed to integer type
So, the compiler realizes your mistake and fixes it for you, but I
still think that one should go with the standard (I will admit
that up until recently I've been using void main() :)
Just rambling,
Colin Walsh
cwalsh AT nf DOT sympatico DOT ca
- Raw text -