in reply to Re^5: [OT]: Flushing XS buffers portably
in thread [OT]: Flushing XS buffers portably

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