inside main(), a call is made to function testo() which simply returns a double(1415.149). The correct double value is returned only if main.c has #include <f.h>, which is where testo() is declared. I've compiled two versions of this program, with and without the include line, withinclude.a.out and withoutinclude.a.out, respectively. The assembled code varies slightly between the two, withoutinclude.a.out having the following extra three lines shown below (with xxx): realnum=testo(); 8048384: e8 2b 00 00 00 call 80483b4 <testo> 8048389: 50 push %eax xxx 804838a: db 04 24 fildl (%esp) xxx 804838d: 8d 64 24 04 lea 0x4(%esp),%esp xxx 8048391: dd 5d f8 fstpl 0xfffffff8(%ebp) fildl takes the pushed value (0xa) and stores it onto the floating point stack and then fetched by fstpl, which is then stored in realnum. This code does NOT get generated if there is an #include <f.h> in main.c
The C standard says that if a function is not declared (prototyped) then implicately it returns the type of int.
Created attachment 10422 [details] output of gcc -v
Created attachment 10423 [details] testo() function definition file from gcc --save-temps
Created attachment 10424 [details] main() function definition file from gcc --save-temps
(In reply to comment #1) > The C standard says that if a function is not declared (prototyped) then > implicately it returns the type of int. > ok thanks, that makes sense =)