This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

functions calls Vs calls using function pointers


Hello,
I am trying to understand how cc1 works  ,and was going through the
gcc-4.0.3 source , and after a lot of research , found  functions for
parsing Declaration/Definitions(gcc-4.0.3/gcc/c-decl.c:
grokdeclarator) and "actual function calls" used inside a translation
unit ,in (gcc-4.0.3/gcc/calls.c:prepare_call_address )in the C
compilation process .

The problem however is when i choose to call a function using
function-pointers ,the name of the function pointer appears as "-" in
this prepare_call_address function (as seen in gdb). Can anyone point
me to a C file/function in the gcc source tree where the compiler
knows the exact  function-pointer name being used to call a function.
typedef void (*fptr) (int);
void A(int);
int main()
{
fptr fp;
fp=A;
fp();
}
void A(int i){printf("in A\n");}

when i try and compile this , using gcc, its quick to point an error :
too few arguments to fp;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]