develooper Front page | perl.perl5.porters | Postings from February 2001

5.6.0 bug involving proto'd functions calling themselves

From:
Jeff Pinyan
Date:
February 28, 2001 06:17
Subject:
5.6.0 bug involving proto'd functions calling themselves
Message ID:
Pine.GSO.4.21.0102280916450.15236-100000@crusoe.crusoe.net
On Feb 22, Andrew Hamm said:

>    main::rec() called too early to check prototype at rec line 9.
>
><STUFF>
>#!/usr/bin/perl -w
>use strict;
>
>## sub rec($);
>sub rec($) {
>    my $i = shift;
>
>    print "$i\n";
>    rec($i + 1) if $i < 3;
>}
>
>rec(0);
></STUFF>
>
>If you uncomment the forward declaration at line 4, the warning message goes
>away. I don't think that's right. Opinions please?

The function prototype is not registered until the function is finished
being compiled.  However, in the process of compiling the function, the
opcode for calling that same function is found.

It seems silly, though.  I shall forward this report to P5P.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/





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