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

[perl #34231] prototype mismatch warning and sub fwd declaration

From:
Father Chrysostomos via RT
Date:
October 13, 2011 00:15
Subject:
[perl #34231] prototype mismatch warning and sub fwd declaration
Message ID:
rt-3.6.HEAD-31297-1318490096-854.34231-15-0@perl.org
On Wed Feb 23 01:46:36 2005, dint wrote:
> This is a bug report for perl from Peter.Dintelmann@dresdner-bank.com,
> generated with the help of perlbug 1.35 running under perl v5.8.6.
> 
> A subroutine forward declaration without a prototype
> does not cause a prototype mismatch warning when the
> sub is later declared with a prototype.
> 
>     $ perl586 -Mwarnings -e 'sub x; sub x () {}'
>     $
> 
> In Perl 5.6.1 a warning is produced in this situation.
> 
>     $ perl561 -Mwarnings -e 'sub x; sub x () {}'
>     Prototype mismatch: sub main::x vs () at -e line 1.
>     $

I think that was actually a bug fix.  ‘sub x;’ has the same effect as
‘\&x’.  Taking a reference to a not-yet-existent sub should not make the
definition of that sub warn, I don’t think.




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