# file: printf.pl printf "%4.4f\n", 3.14159; printf "%4.4lf\n", 3.14159; printf "%4.4hf\n", 3.14159; printf "%4.4qf\n", 3.14159; printf "%4.4Lf\n", 3.14159; printf "%4.4llf\n", 3.14159;
Results:
$ /usr/bin/perl5.6.1 printf.pl 3.1416 3.1416 3.1416 %4.4qf %4.4Lf %4.4llf $ /usr/local/bin/perl5.8.0 printf.pl 3.1416 %4.4lf %4.4hf %4.4qf 3.1416 3.1416
As it turns out, none of these printf size flags are tested in either 5.6.1 or 5.8.0 core tests. The relevant config details for each version are the same (snipped for brevity):
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuratio +n: use64bitint=undef use64bitall=undef uselongdouble=undef intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, usemymalloc=n, prototype=define Summary of my perl5 (revision 5.0 version 8 subversion 0) configuratio +n: use64bitint=undef use64bitall=undef uselongdouble=undef intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=4, prototype=define
This was noticed when installing Text::Reform with 5.8.0, the module has a single case of using sprintf with an 'lf' (at line 141) which passes all tests on my 5.6.1 but fails on my 5.8.0. My questions: is it at all wise to use these size flags? Is this a perl bug not detected because it isn't tested for? Shouldn't the size flags (l,h,q,L,and ll) simply be ignored if unsupported on a given platform? (platform is linux)
In reply to printf size flag incompatibility by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |