Re: null argument where non-null required (argument 2)

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

 




What's the expansion of HvNAME(SvSTASH(SvRV(x)));  ? Is it possible that
it expands to a conditional which in one of the branches returns null?
(although never taken in this specific instance)

I would think that is so. (I haven't actually waded through the plethora of macros, but I would be very surprised if that's not the case.)

Duh ! ... simply run the code through the preprocessor, Rob :-(

If I do that, I find that HvNAME(SvSTASH(SvRV(sv))) expands to a rather long chain of embedded ternary operations, that terminates with the possibility ":(void*)0".

I assume that's the NULL that strcmp sees - and the cause of the warning.

Assigning HvNAME(SvSTASH(SvRV(sv))) to a char*, strcmp is no longer forced to acknowledge the possibility that arg 2 might be NULL, and no warning ensues.

So ... I guess I'll stay with that fix, unless someone tells me of a better one.

Cheers,
Rob


[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