in reply to Re: Re: printf size flag incompatibility
in thread printf size flag incompatibility

printf doesn't really care whether the arguments are integers or not, it cares about what the size flags immediately precede. If you use the following code:
use warnings; printf "%4.4i\n", 1; printf "%4.4li\n", 1; printf "%4.4hi\n", 1; printf "%4.4qi\n", 1; printf "%4.4Li\n", 1; printf "%4.4lli\n", 1;
You then almost get the results that are predicted in the perldocs:
0001 0001 0001 Invalid conversion in printf: "%q" at - line 5. %4.4qi 0001 0001
(the zeroes are there because 4.4 ensures that the number will be 4 digits long in the case of an int)

Of course, there's still that rogue q that doesn't work in 5.6.1 or 5.8.0. However, since q should be the same as L and ll, it's not like Perl is lacking some feature--they just lie about q being a valid alias.

Again: l and h should only be used when followed by i, never by f. Perl, C, and GNU all appear to agree on this.