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

The '3' is the manual page section ("library calls") where the function is documented... :)   (an old unix convention — typically, I avoid using it for just that reason... sorry I didn't in this case).

I guess that's likely to work on other operating systems as well ?

Yes I'd think so, it's a pretty standard library call (ANSI C - X3.159-1989, the man page says).

  • Comment on Re^5: [OT]: Flushing XS buffers portably

Replies are listed 'Best First'.
Re^6: [OT]: Flushing XS buffers portably
by syphilis (Archbishop) on Aug 31, 2007 at 15:22 UTC
    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