Re: function pointer is not initializing to NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sharathyd wrote:
> 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!

It's hard to tell because you haven't really given us enough information.

Can you produce a test case (a complete, compilable and runnable program)
that demonstrates this problem?

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux