some strangeness with gcc 3.4.1
chris jefferson
caj@cs.york.ac.uk
Sat Sep 11 22:12:00 GMT 2004
Marty Leisner wrote:
>This program won't compile with gcc 3.4.1:
>
>: leisner@soyata;cat foo.c
>
>foo()
>{
> bar();
>}
>
>void bar()
>{
>}
>
>
>
This code shouldn't really have ever compiled, I'm suprised it did
previously.
By default if a c compiler finds a function without a prototype if tries
to guess at what it should be, and always guesses the return value is
int. Therefore in this case it guesses bar's prototype is "int
bar(void)", which obviously conflicts with what you later define.
The correct way to fix this is to define bar before using it (which
really you should do anyway.
More information about the Gcc
mailing list