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

Re: [ID 20000403.009] uninitialised concatenation???

Thread Previous | Thread Next
From:
Ronald J Kimball
Date:
April 4, 2000 07:51
Subject:
Re: [ID 20000403.009] uninitialised concatenation???
Message ID:
20000404105102.B299251@linguist.dartmouth.edu
On Tue, Apr 04, 2000 at 06:45:31PM +0400, Konovalov, Vadim wrote:
> 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 '

The C programmer here has explicitly defined my_type to be the same as int.
If the programmer becomes confused, it is his own fault.

On the other hand, the Perl programmer has not explicitly defined string
interpolation to be the same as string concatenation.  That is an
implementation detail of the Perl compiler.  The programmer should not be
required to know the internals of the compiler.


Ronald

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