Front page | perl.perl5.porters |
Postings from February 2003
Re: [perl #20339] Possible sprintf problem in perl5.8.0
Thread Previous
|
Thread Next
From:
hv
Date:
February 10, 2003 15:21
Subject:
Re: [perl #20339] Possible sprintf problem in perl5.8.0
Message ID:
200302102323.h1ANNBo17368@crypt.compulink.co.uk
sthoenna@efn.org (Yitzchak Scott-Thoennes) wrote:
:On Fri, 17 Jan 2003 09:01:24 +0000, hv@crypt.org wrote:
:>sthoenna@efn.org (Yitzchak Scott-Thoennes) wrote:
:>:so I think %lf should be silently treated as %f.
:>
:>Thanks; the relevant chunk for floating point formats also drops
:>a fail on '%hf'; should this also be silently allowed? I'm
:>guessing not ...
:
:Failure on hf is ok.
Thanks, I've applied the patch below as change #18689 (and #18690).
:The following combinations must be supported per C99:
:
:modifier format
:h,hh,ll,j,z,t d,i,o,u,x,X,n
:l d,i,o,u,x,X,n,c,s,a,A,e,E,f,F,g,G
:L a,A,e,E,f,F,g,G
Hmm, we haven't heard of half of those.
The code currently checks for these modifiers:
I only if defined(WIN32)
I32 only if defined(WIN32)
I64 only if (defined(WIN32) && defined(WIN64))
L only if (defined(HAS_QUAD) || defined(HAS_LONG_DOUBLE))
q only if defined(HAS_QUAD)
l
ll only if (defined(HAS_QUAD) || defined(HAS_LONG_DOUBLE))
h
V
Can you explain what those others do?
:"If a length modifier appears with any conversion specifier other
:than as specified above, the behavior is undefined."
We haven't even achieved that ... :)
Hugo
--- sv.c.old Mon Feb 10 23:59:06 2003
+++ sv.c Mon Feb 10 23:59:12 2003
@@ -8813,6 +8813,9 @@
intsize = 'q';
#endif
break;
+/* [perl #20339] - we should accept and ignore %lf rather than die */
+ case 'l':
+ /* FALL THROUGH */
default:
#if defined(USE_LONG_DOUBLE)
intsize = args ? 0 : 'q';
@@ -8825,8 +8828,6 @@
/* FALL THROUGH */
#endif
case 'h':
- /* FALL THROUGH */
- case 'l':
goto unknown;
}
--- t/op/sprintf.t.old Sun Sep 8 18:00:52 2002
+++ t/op/sprintf.t Tue Feb 11 00:04:40 2003
@@ -273,6 +273,8 @@
>%.0f< >-1.6< >-2<
>%.0f< >1< >1<
>%#.0f< >1< >1.<
+>%.0lf< >1< >1< >'l' should have no effect<
+>%.0hf< >1< >%.0hf INVALID< >'h' should be rejected<
>%g< >12345.6789< >12345.7<
>%+g< >12345.6789< >+12345.7<
>%#g< >12345.6789< >12345.7<
Thread Previous
|
Thread Next