I believe that the numeric value of the type is used in a few places, such
as fastraw. For binary compatibility, it'd be best to avoid changing the
numbering.
But we can assign -1 as the first value of an enum! So, we can add BAD_TYPE
if we set the enum declaration as:
enum {
BAD_TYPE = -1,
b
In the ANYVAL_FROM_CTYPE macro, -1 for the type and 0 for the value is the
result when an non-handled type is processed. It probably works ok if an
enum were "just an int". More properly, we could add an PDL_INVALID to the
enum for types to handle the case. Given the fagility of the PDL-2.x type
I get the following error (16 times; 2 for each datatype) from Bad.xs when
building PDL with clang on my Mac:
> Bad.xs:9487:19: warning: comparison of constant -1 with expression of type
> 'pdl_datatypes' is always true
> [-Wtautological-constant-out-of-range-compare]
> if ( val.type !