questions about gcc options

Mamta BANSAL mamta.bansal at st.com
Mon Nov 28 07:09:12 GMT 2005


Hello
         for a c code i am using gcc compiler.
i have doubt using -c option.
for a c code the code compiles (without error ) with -c option even if i 
don't provide prior declaration of function.
i mean i have try.c
//*******************

void my_func( ){
call_to_undeclared_func( );
}
//********************
i do : gcc -c try.c , it works.
is it the correct behaviour , i mean should it not ask for atleast 
declearation of call_to_undeclared_func( );

like if my make the same as try.cpp then usen use the same command it 
gives the foll. error.:

try.cpp: In function `void my_func()':
try.cpp:2: implicit declaration of function `int 
 call_to_undeclared_func(...)'
which i feel is expected behaviour.

Best Regards
Mamta




More information about the freebsd-questions mailing list