Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How are lexical warnings supposed to work? #105

Closed
p5pRT opened this issue Jun 23, 1999 · 1 comment
Closed

How are lexical warnings supposed to work? #105

p5pRT opened this issue Jun 23, 1999 · 1 comment

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Jun 23, 1999

Migrated from rt.perl.org#909 (status was 'resolved')

Searchable as RT909$

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Jun 23, 1999

From @jandubois

#================================
use warning;
{
  print "Oops\n" if $var == 1;
  print "Done\n";
}
#--------------------------------
perl unint.pl
Name "main​::var" used only once​: possible typo at uninit.pl line 4.
Use of uninitialized value at uninit.pl line 4.
Done
#================================

which is as expected. But​:

#================================
{
  use warning;
  print "Oops\n" if $var == 1;
  print "Done\n";
}
#--------------------------------
perl uninit.pl
Use of uninitialized value at uninit.pl line 4.
Done
#================================

Why did the "once" warning go away? And if I disable any warning​:

#================================
use warning;
{
  no warning qw(printf);
  print "Oops\n" if $var == 1;
  print "Done\n";
}
#--------------------------------
perl uninit.pl
Name "main​::var" used only once​: possible typo at uninit.pl line 5.
Done
#================================

The "uninitialized" message goes away (but shouldn't IMO). Am I missing
something or does it just not work yet reliably?

-Jan

perl -V
Summary of my perl5 (revision 5.0 version 5 subversion 57) configuration​:
  Platform​:
  osname=MSWin32, osvers=4.0, archname=MSWin32-x86
  uname=''
  config_args='undef'
  hint=recommended, useposix=true, d_sigaction=undef
  usethreads=undef useperlio=undef d_sfio=undef
  use64bits=undef usemultiplicity=undef
  Compiler​:
  cc='cl.exe', optimize='-O2 -MD -DNDEBUG', gccversion=
  cppflags='-DWIN32'
  ccflags ='-O2 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT '
  stdchar='char', d_stdstdio=define, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
  alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries​:
  ld='link', ldflags ='-nologo -nodefaultlib -release -machine​:x86'
  libpth=i​:\vs\vc98\lib
  libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib
odbccp32.lib PerlCRT.lib
  libc=PerlCRT.lib, so=dll, useshrplib=yes, libperl=perl.lib
  Dynamic Linking​:
  dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-machine​:x86'

Characteristics of this binary (from libperl)​:
  Locally applied patches​:
  g​:/incoming/perl/Patches/Change.3484
  g​:/incoming/perl/Patches/pwenttest.diff
  Built under MSWin32
  Compiled at May 29 1999 09​:58​:50
  @​INC​:
  i​:/tmp/perl/557-opt/lib/MSWin32-x86
  i​:/tmp/perl/557-opt/lib
  i​:/tmp/perl/site/557-opt/lib/MSWin32-x86
  i​:/tmp/perl/site/557-opt/lib
  .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.