Front page | perl.perl5.porters |
Postings from March 2001
[ID 20010306.002] for/while difference in for definition
Thread Next
From:
abela
Date:
March 6, 2001 00:45
Subject:
[ID 20010306.002] for/while difference in for definition
Message ID:
20010306084036.7BFD0D17F@little-roots.geneanet.org
This is a bug report for perl from Jerome.Abela@free.fr,
generated with the help of perlbug 1.28 running under perl v5.6.0.
-----------------------------------------------------------------
[Please enter your report here]
perlsyn says:
> Perl's C-style `for' loop works exactly like the correĀ
> sponding `while' loop; that means that this:
>
> for ($i = 1; $i < 10; $i++) {
> ...
> }
>
> is the same as this:
>
> $i = 1;
> while ($i < 10) {
> ...
> } continue {
> $i++;
> }
>
> (There is one minor difference: The first form implies a
> lexical scope for variables declared with `my' in the iniĀ
> tialization expression.)
It can't be both "exactly like" and with "one minor difference"...
I suggest the following change:
{
$i = 1;
while ($i < 10) {
...
} continue {
$i++;
}
}
(Note that both forms imply lexical scope for variables declared
with `my' in the initialization expression.)
Jerome.
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=docs
severity=low
---
Site configuration information for perl v5.6.0:
Configured by pixel at Fri Mar 31 16:32:49 CEST 2000.
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=linux, osvers=2.2.15-0.16mdksmp, archname=i386-linux
uname='linux kenobi.mandrakesoft.com 2.2.15-0.16mdksmp #1 smp mon mar 13 16:40:10 cet 2000 i686 unknown '
config_args='-des -Dprefix=/usr -Darchname=i386-linux -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Ud_csh -Dman3dir=/usr/lib/perl5/man/man3 -Doptimize=-O3 -fomit-frame-pointer -fno-exceptions -fno-rtti -pipe -s -mpentium -mcpu=pentium -march=pentium -ffast-math -fexpensive-optimizations'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define
use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
Compiler:
cc='cc', optimize='-O3 -fomit-frame-pointer -fno-exceptions -fno-rtti -pipe -s -mpentium -mcpu=pentium -march=pentium -ffast-math -fexpensive-optimizations', gccversion=2.95.3 19991030 (prerelease)
cppflags='-fno-strict-aliasing'
ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lposix -lcrypt
libc=/lib/libc-2.1.3.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.6.0:
/usr/lib/perl5/5.6.0/i386-linux
/usr/lib/perl5/5.6.0
/usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/perl5/site_perl/5.6.0
/usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005
/usr/lib/perl5/site_perl
.
---
Environment for perl v5.6.0:
HOME=/home/abela
LANG=fr
LANGUAGE=fr
LC_ALL=fr_FR
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/X11R6/bin:/usr/local/bin:/bin:/usr/bin:/home/abela/bin:/usr/java/jdk1.3/bin
PERL_BADLANG (unset)
SHELL=/bin/bash
Thread Next
-
[ID 20010306.002] for/while difference in for definition
by abela