On Wed, 20 Sep 2000, Steve Fink wrote:
> 1 my ($x, $y, $z);
> 2 $z = 1;
> 3 my $logfile = "/tmp/log";
> 4 $x = 1 if cond();
> 5 print $x+$y;
> 6 undef $z;
> 7 print $z;
>
> --> use of uninitialized variable $y in line 5 (compile time)
> --> possible use of uninitialized variable $x in line 5 (compile time)
> --> variable $logfile defined in line 3 but never used (compile time)
> --> use of undefined value in line 7 (run time)
Couldn't the error on line 7 be detected at compile time as well?
After all, there is no execution path which will result in $z having a
defined value.
Dave
- RFC 12 (v2) variable usage warnings Perl6 RFC Librarian
- Re: RFC 12 (v2) variable usage warnings Tom Christiansen
- Re: RFC 12 (v2) variable usage warnings Steve Fink
- Re: RFC 12 (v2) variable usage warnings Tom Christiansen
- Re: RFC 12 (v2) variable usage warnin... Steve Fink
- Re: RFC 12 (v2) variable usage warnin... Bart Lateur
- Re: RFC 12 (v2) variable usage warnings Dave Storrs
- Re: RFC 12 (v2) variable usage warnings Eric Roode
- Re: RFC 12 (v2) variable usage warnings Steve Fink
- Re: RFC 12 (v2) variable usage warnings Tom Christiansen
- Re: RFC 12 (v2) variable usage warnin... Steve Fink
- Re: RFC 12 (v2) variable usage w... Tom Christiansen
- Re: RFC 12 (v2) variable usa... Steve Fink
- Re: RFC 12 (v2) variable... Tom Christiansen
- Re: RFC 12 (v2) variable... Steve Fink
- Re: RFC 12 (v2) variable... Tom Christiansen
- Re: RFC 12 (v2) variable... Daniel Chetlin
