develooper Front page | perl.perl5.porters | Postings from December 2013

When do we use PERLIO vs STDIO

Thread Next
From:
Karl Williamson
Date:
December 17, 2013 20:58
Subject:
When do we use PERLIO vs STDIO
Message ID:
52B0BAF2.9020108@khwilliamson.com
I discovered that ext/XS-APItest/APItest.xs is testing the libc 
functions like printf().  We think (on irc) that it is intending to be 
testing the PERLIO equivalents instead.  Does anyone know?

Looking into how printf becomes a macro that translates into a PerlIO 
function, it happens in the header fakesdio.h, which is currently never 
included, as it happens only if PERLIO_NOT_STDIO is undefined, and by 
the time it is checked, previous code in the including file (perlio.h) 
has made sure that it is defined.

PERLIO_NOT_STDIO set to 1 means that an error gets generated if an 
attempt is made to use stdio functions; 0 means that both Perlio and 
stdio are enabled, and one has to explicitly use the Perlio functions in 
order to get them.  And "undef" means that the stdio functions 
automatically are replaced by Perlio equivalents.  That all seems 
reasonable, except that "undef" never currently can happen.  Leon summed 
up the current behavior on irc as:

PERLIO_NOT_STDIO=0 is the normal mode of operation
PERLIO_NOT_STDIO=undef sets PERLIO_NOT_STDIO=PERL_CORE

That means that attempts in PERL_CORE to use stdio functions will 
generate errors; but not otherwise.

So what do we want the general XS writer to get?  What should APItest.xs 
be doing?


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About