function pointer is not initializing to NULL

sharathyd sharath.yd@rediffmail.com
Tue Apr 15 11:03:00 GMT 2008


Hi,

I'm using AIX 5.1 and gcc 4.0 version to build my software. Here I'm finding
some problem in runtime.
Here we have static function pointer that is initialized to NULL. Here is
the below cases...

static int (*retrivalFunc)(char *attr, char *option, returnCode *codePtr,
char *buf) = NULL;

sampleFunc() {

if (attRetrivalfunc != NULL) {
return(retrivalFunc(attName, dataBuf,codePtr, msg));
}
}

Here at run time for the first only directly its coming to this if loop (ie.
!=NULL case), and causing problem.
But if I remove the NULL initialization, its working fine. I think 'static'
will initialize. But why this is not initializing if I explicitly do? Is
this problem with AIX environment or gcc? Thanks for any suggestion!

Thanks & Regards,
Sharath.
-- 
View this message in context: http://www.nabble.com/function-pointer-is-not-initializing-to-NULL-tp16699155p16699155.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list