develooper Front page | perl.perl5.porters | Postings from April 2000

RE: [ID 20000403.009] uninitialised concatenation???

Thread Previous | Thread Next
From:
Konovalov, Vadim
Date:
April 4, 2000 07:46
Subject:
RE: [ID 20000403.009] uninitialised concatenation???
Message ID:
402099F49BEED211999700805FC7359F4DE9F0@ru0028exch01.spb.lucent.com
> From: Richard Foley [mailto:Richard.Foley@m.dasa.de]
> Tom Christiansen wrote:
> > 
> > >How about the much less inflamatory, and much more useful:
> > 
> > How about addressing the real issue?
> > 
> > % perl -lwe '@a[0,2] = (0,2); print "@a $a", "$a", $a'
> > Use of uninitialized value in join at -e line 1.
> > Use of uninitialized value in concatenation (.) at -e line 1.
> > Use of uninitialized value in string at -e line 1.
> > Use of uninitialized value in print at -e line 1.
> > 
> > Those are all different cases.  They should not be conflated just
> > to stick a pacifier in the mouths of the confused, because that
> It seems a shame to have to use another language, just 
> because a couple of
> warnings confuse once in a while.

Why so many people are confusing? If one have brain then such warnings may
be understood clearly. If that warning is misleading, why other compiler's
warnings are easily understood?

Look:

a.c
#include <stdio.h>
typedef int my_type;
void main () {
  my_type a;
  printf(a);
}

MSVC++:
d:\TESTS\x>cl a.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

a.c
a.c(5) : warning C4047: 'function' : 'const char *' differs in levels of
indirection from 'int '
a.c(5) : warning C4024: 'printf' : different types for formal and actual
parameter 1
a.c(5) : warning C4700: local variable 'a' used without having been
initialized
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:a.exe
a.obj


BROKEN: a is 'my_type', not 'int '


GCC:
d:\TESTS\x>gcc a.c
a.c: In function `main':
a.c:5: warning: passing arg 1 of `printf' makes pointer from integer without
a cast
a.c:3: warning: return type of `main' is not `int'

BROKEN: a is 'my_type', not integer

Thread Previous | Thread Next


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