On Mon, 30 Sep 2002, Brent Dax wrote:

> Andy Dougherty:
> # More generally, though, rather than sprinkling the sources 
> # with INTVAL_FMT and other ugly (but correct and portable 
> # things), should we be trying to 
> # funnel everything through a central printf-like engine and 
> # have it automatically provide the correct formats?  
> # perl-5.8.0 somewhat belatedly introduced something like that, 
> # and it seems like a good idea.
> 
> *elbows him in the side and points at /Parrot_v?sn?printf(_[sc])?/ in
> misc.c*

Interesting, yes, that's mostly what I had in mind, but I'm unsure just
how it's intended to be used.[*] That is, if I have

        INTVAL iv = 7;

what format do I use to print it?  Is it the intent that 

    Parrot_sprintf_c(interpreter, "i=%d\n", i);

will work?  Or do I need some special format character, like

    Parrot_sprintf_c(interpreter, "i=%Vd\n", i);

(to borrow perl5's sv.c:Perl_sv_vcatpvfn notation).

As a side note, I see that misc.c currently seems to assume that
sizeof(long) >= sizeof(INTVAL), so I'll need to patch that up anyway, but
at the moment, I'm unclear even as to intention.

[*]As another curious side note, the Parrot_sprintf functions require a
Parrot interpreter.  Whether it's safe to pass that interpreter object
around while inside the trace function (which is where I got started) or
inside sundry debug functions is another possibly interesting question,
but largely irrelevant for the bigger issue at hand.

    Andy Dougherty              [EMAIL PROTECTED]



Reply via email to