Discussion:
[Pdl-porters] PDLSTATEISBAD vs ISPDLSTATEBAD
David Mertens
2013-12-05 20:04:51 UTC
Permalink
Hey all -

For some strange reason, we have *both* of these macros defined in PDL::PP.
I recently noticed that the documentation for PDL::PP mentions macros using
the first naming convention, but not the second. You have to look in
BadValues.pod to see the difference:

'$PDLSTATEISBAD(a)' -> '($PDL(a)->state & PDL_BADVAL) > 0'
'$ISPDLSTATEBAD(a)' -> '((a->state & PDL_BADVAL) > 0)'

The first form is supposed to be used in Code sections, whereas the second
form is supposed to be used in xxxBadStatusCode sections. The thing is,
I've used the second form in my Code sections without any problems. That
seems to suggest that $PDL(var) is equivalent to var in most C code...
which led me on a search for the expansion of the $PDL macro... which I
cannot find. It's not grouped with the other macro substitution code and it
fails the grep test.

Can anybody shed light on where the $PDL macro is implemented?

Thanks!
David
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." -- Brian Kernighan
Loading...