That does explain it. I was still leery of what goings on inside the SvIOK/SvUOK macros might be influencing it, so I substituted a volatile variable as the conditional:

volatile int n; void test2 ( SV *sv ) { double d1 = n ? SvNV( sv ) : SvIV( sv ); double d2 = n ? SvNV( sv ) : SvUV( sv ); return; }

And sure enough that silenced the warnings.

Whilst that definitively takes XS off the hook, moving it to either the C/C++ standard or the compiler, it still leaves a bad taste in the mouth. Given this is a warning rather than an error; and that even the wording "possible loss of data" hedges its bets; I'd personally prefer the warning to be issued if there is the 'possibility of data loss', rather than not issued if there is the 'possibility that no data will be lost'.

That said, given my enmity for things like const correctness and PerlCritic, I wonder if I'm in danger of asking for a similar level of cry-wolfism?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^9: perl inline::c sorting problem (implicit coercion) by BrowserUk
in thread perl inline::c sorting problem by dalittle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.