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,
  byte,
  ...
};

David

On Thu, May 5, 2016 at 5:38 PM, Chris Marshall <devel.chm...@gmail.com>
wrote:

> 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 types
> support, I lean towards ignoring the warning rather than possibly opening a
> can of worms...
>
> --Chris
>
>
> On Thu, May 5, 2016 at 12:36 PM, Derek Lamb <de...@boulder.swri.edu>
> wrote:
>
>> 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 != -1 ) { ANYVAL_TO_CTYPE(PDL->bvals.Byte, PDL_Byte,
>> val); }
>> >          ~~~~~~~~ ^  ~~
>> >
>>
>>
>> val.type is of type pdl_datatypes, which is an enum, so valid values are
>> >=0.  In Bad.c it is assigned -1 if (!SvOK(ST(0))) — some error condition
>> that is probably unlikely to be reached.
>>
>> So I think I understand what's trying to be done there, but is there a
>> better way to do it?  It is just a warning, but it looks bad. <rimshot>
>>
>> Derek
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Find and fix application performance issues faster with Applications
>> Manager
>> Applications Manager provides deep performance insights into multiple
>> tiers of
>> your business applications. It resolves application problems quickly and
>> reduces your MTTR. Get your free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
>> _______________________________________________
>> pdl-devel mailing list
>> pdl-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/pdl-devel
>>
>
>
>
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications
> Manager
> Applications Manager provides deep performance insights into multiple
> tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> _______________________________________________
> pdl-devel mailing list
> pdl-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pdl-devel
>
>


-- 
 "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
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
pdl-devel mailing list
pdl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-devel

Reply via email to