This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sprintf: handle sized int-ish formats with Inf/Nan
authorDavid Mitchell <davem@iabyn.com>
Tue, 16 May 2017 15:30:13 +0000 (16:30 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 7 Jun 2017 08:11:01 +0000 (09:11 +0100)
commit559a021f1d52c32a82cbdf9184aa59a58e898b08
tree8192e8c150af140cb83bc1dd61181eb3cf336c2a
parent5a5fe90db443ad067e76362e551375647b619ab9
sprintf: handle sized int-ish formats with Inf/Nan

The code path taken when int-ish formats saw an Inf/Nan was to jump to the
floating-point handler, but then that would warn about (valid) size
qualifiers. For example before:

    $ perl -we'printf "[%hi]\n", Inf'
    Invalid conversion in printf: "%hi" at -e line 1.
    Redundant argument in printf at -e line 1.
    [%hi]
    $

After this commit:

    $ perl -we'printf "[%hi]\n", Inf'
    [Inf]
    $

It also makes the code simpler.
sv.c
t/op/infnan.t