in reply to Re^6: perl inline::c sorting problem (implicit coercion)
in thread perl inline::c sorting problem
I'm running a 64-bit build of Perl, making IVs & UVs 64-bit. As you pointed out to me a long time ago, a 64-bit double can hold at most a 53-bit integer. Therefore there is a potential that assigning either of the former to the latter, could result in loss of data. I expected a warning.
And indeed, if I try this with straight C, I get those warnings:
<void test2 ( SV *sv ) { double d = SvIV( sv ); double d2 = SvUV( sv ); return; } IC_sort.c IC_sort.xs(42) : warning C4244: 'initializing' : conversion from 'IV' +to 'double', possible loss of data IC_sort.xs(43) : warning C4244: 'initializing' : conversion from 'UV' +to 'double', possible loss of data
Hence, I attribute their absence to "the magic of XS".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: perl inline::c sorting problem (implicit coercion)
by syphilis (Archbishop) on May 03, 2009 at 10:08 UTC | |
by BrowserUk (Patriarch) on May 03, 2009 at 10:41 UTC |