Compiling Math::BigInt::FastCalc with VC++ produces a couple of warnings:

FastCalc.xs(397) : warning C4244: 'function' : conversion from 'double ' 
to 'long ', possible loss of data
FastCalc.xs(399) : warning C4244: '+=' : conversion from 'double ' to 
'unsigned int ', possible loss of data

These both come from the _len XSUB:

388:  INIT:
389:    AV*    a;
390:    SV*    temp;
391:    NV    elems;
392:    STRLEN len;
393:
394:  CODE:
395:    a = (AV*)SvRV(x);            /* ref to aray, don't check ref */
396:    elems = (NV) av_len(a);        /* number of elems in array */
397:    temp = *av_fetch(a, elems, 0);    /* fetch last element */
398:    SvPV(temp, len);            /* convert to string & store length */
399:    len += XS_BASE_LEN * elems;
400:    ST(0) = newSViv(len);

The first warning is removed by the following

==== //depot/perl/ext/Math/BigInt/FastCalc/FastCalc.xs#1 - 
C:\p5p\bleadperl\ext\Math\BigInt\FastCalc\FastCalc.xs ====
@@ -388,12 +388,12 @@
   INIT:
     AV*        a;
     SV*        temp;
-    NV elems;
+    I32        elems;
     STRLEN len;

   CODE:
     a = (AV*)SvRV(x);                  /* ref to aray, don't check ref */
-    elems = (NV) av_len(a);            /* number of elems in array */
+    elems = av_len(a);                 /* number of elems in array */
     temp = *av_fetch(a, elems, 0);     /* fetch last element */
     SvPV(temp, len);                   /* convert to string & store 
length */
     len += XS_BASE_LEN * elems;

But what's the best way to clear up the second warning, given that elems 
could in theory be -1 for an empty array?  I'm not sure if that could 
ever happen in practice, or what _len() should do in that case.



------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are 
confidential and intended for the addressee(s) only.  If you have received this 
message in error or there are any problems, please notify the sender 
immediately.  The unauthorized use, disclosure, copying or alteration of this 
message is strictly forbidden.  Note that any views or opinions presented in 
this email are solely those of the author and do not necessarily represent 
those of Radan Computational Ltd.  The recipient(s) of this message should 
check it and any attached files for viruses: Radan Computational will accept no 
liability for any damage caused by any virus transmitted by this email.

Reply via email to