develooper Front page | perl.perl5.porters | Postings from October 2014

Re: [perl #122934] Warning on extra printf arguments

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
October 9, 2014 10:55
Subject:
Re: [perl #122934] Warning on extra printf arguments
Message ID:
20141009105500.GU5204@iabyn.com
On Thu, Oct 09, 2014 at 02:23:36AM -0700, Ed Avis wrote:
> printf and sprintf should warn if too many arguments are given.
> For example
> 
>     printf('%d', 1, 2);
> 
> should produce the warning 'too many arguments for printf at line...'.

It does so in 5.21.2 onwards:

    $ perl5212 -we'printf("%d", 1, 2);'
    Redundant argument in printf at -e line 1.
    1
    $ perl5212 -we'my $x=sprintf("%d", 1, 2);'
    Redundant argument in sprintf at -e line 1.
    $


-- 
Never do today what you can put off till tomorrow.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About