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

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

Father Chrysostomos via RT
October 13, 2011 00:15
[perl #34231] prototype mismatch warning and sub fwd declaration
Message ID:
On Wed Feb 23 01:46:36 2005, dint wrote:
> This is a bug report for perl from,
> 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. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About