| From | Sent On | Attachments |
|---|---|---|
| kmx via RT | Mar 3, 2010 1:47 am | |
| Steve Hay | Mar 4, 2010 8:40 am | |
| Dave Mitchell | Mar 4, 2010 12:17 pm | |
| Steve Hay | Mar 4, 2010 4:17 pm | |
| Jan Dubois | Mar 4, 2010 6:53 pm | |
| Jan Dubois | Mar 4, 2010 7:07 pm | |
| kmx via RT | Mar 4, 2010 11:15 pm | |
| Jan Dubois | Mar 5, 2010 12:26 am | |
| Steve Hay | Mar 5, 2010 1:18 am | |
| Jan Dubois | Mar 5, 2010 12:50 pm | |
| kmx | Mar 5, 2010 11:52 pm | |
| Tim Bunce | Mar 6, 2010 1:37 pm | |
| kmx via RT | Apr 11, 2010 2:35 am | |
| Jan Dubois via RT | Apr 21, 2010 11:55 pm | |
| kmx via RT | Apr 22, 2010 10:46 am | |
| kmx via RT | May 5, 2010 4:30 am | |
| Jan Dubois | May 5, 2010 12:26 pm | |
| Tim Bunce | May 6, 2010 4:05 am | |
| Craig A. Berry | May 6, 2010 6:21 am |
| Subject: | Re: [perl #72704] Buggy fputs(f,s) vs. fputs(s,f) on Win32 (maybe not only) | |
|---|---|---|
| From: | Dave Mitchell (dav...@iabyn.com) | |
| Date: | Mar 4, 2010 12:17:36 pm | |
| List: | org.perl.perl5-porters | |
On Thu, Mar 04, 2010 at 04:40:41PM -0000, Steve Hay wrote:
Sorry, I meant to reply to this earlier but completely forgot.
I think it is deliberate: it is explicitly mentioned in perlapio.pod that the
arguments have been reversed compared to the C library function (probably so
that all the PerlIO functions have the 'f' first). And there's a further comment
about it in perlxstut.pod too.
Are you sure the arguments are not reversed on Linux too? There's no mention of
the reversal being Win32-specific.
While the args of the PerlIO functions are explicity reversed, I think that OP is right, in that something is probably awry with the macro expansions.
For example in fakesdio.h, you have
#define fputs(s,f) PerlIO_puts(f,s)
which does the correct arg reversal.
*However*: out in XS/win32 land, you appear to have:
XSUB.h: #define fputs PerlSIO_fputs
iperlsys.h:
#if defined(PERL_IMPLICIT_SYS) #define PerlSIO_fputs(f,s) (*PL_StdIO->pPuts)(PL_StdIO, (f),(s)) #else #define PerlSIO_fputs(f,s) fputs(s,f) #endif
and the type of function expected in the pPuts slot is LPPuts, which is defined as
typedef int (*LPPuts)(struct IPerlStdIO*, FILE*, const char*);
So under some circumstances,
fputs(str,handle) => PerlIO_puts(str,handle) => (*PL_StdIO->pPuts)(PL_StdIO, (str),(handle))
which doesn't match the LPPuts definition.
But that's a horrible twisty maze of macros that I don't really understand.
-- Any [programming] language that doesn't occasionally surprise the novice will pay for it by continually surprising the expert. -- Larry Wall





