Yes I'd think so, it's a pretty standard library call

Yep ... thanks again almut.

Still, it's something that should be tested in an extension's test script ... so ... one has a module that contains an xsub that doesn't return anything:
void foo(mpfr_t * x) { mpfr_out_str(*x, .......); fflush(stdout); }
How does one verify (in a .t test script) that foo is producing the desired output ?

Heavens forbid ... I'm now straying into on-topic areas, aren't I :-)

Actually ... I'm about to answer the question I just posed, but I'll send this post anyway. As it turns out mpfr_out_str() is not a void function, but returns the number of bytes written (as a size_t). So, to make foo testable, I guess one could just rewrite it as:
SV * foo(mpfr_t * x) { size_t s = mpfr_out_str(*x, .......); fflush(stdout); return newSViv(s); }
And then the test script would simply check that foo($var) returned the expected number of bytes.

If there are any comments on that, please don't be shy :-)

Cheers,
Rob

In reply to Re^6: [OT]: Flushing XS buffers portably by syphilis
in thread [OT]: Flushing XS buffers portably by syphilis

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.