Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: XS on 64-bit: Warning from sv_vsetpvf call

by songmaster (Beadle)
on Jun 27, 2008 at 04:46 UTC ( [id://694314]=note: print w/replies, xml ) Need Help??


in reply to Re: XS on 64-bit: Warning from sv_vsetpvf call
in thread XS on 64-bit: Warning from sv_vsetpvf call

Unfortunately I can't change printf_handler()'s arguments — it's a callback routine for the external library, whose API I can't alter.

My words "non conforming" came from that PDF slideshow I pointed to. Looking at the C99 spec (Draft of May 6, 2005) though, footnote 215 does say you can take the address of a va_list and pass it to other functions, so Perl's API isn't broken as I originally thought. It's not obvious how passing the va_list by value affects the ability to then take the address of the copy, but it certainly seems to.

Hmm, could I copy the original va_list object using va_copy() and then take the address of the copy? That's not particularly efficient, but efficiency doesn't matter much in this case which is in an error path anyway...

Ok, so va_copy() isn't defined, but using __va_copy() works on both 32 and 64-bit systems, with no warnings. Of course using __va_copy() isn't going to be portable to other compilers, but I can probably live with a special case for 64-bit Linux.

  • Comment on Re^2: XS on 64-bit: Warning from sv_vsetpvf call

Replies are listed 'Best First'.
Re^3: XS on 64-bit: Warning from sv_vsetpvf call
by Anonymous Monk on Jun 27, 2008 at 16:35 UTC
    va_copy() was defined in C99. When using gcc you can get it with either -std=c99 or -std=gnu99.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://694314]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found