[M3devel] warning for uninitialized variables?

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Fri Jun 4 01:54:55 CEST 2010


On Wed, Jun 02, 2010 at 03:13:55PM +0000, Jay K wrote:
> 
> Well, I'm certainly not lobbying hard for that, presumably there is no efficient implementation, esp. for full range integers.
> 
> Wikipedia has a nice article. "nice" means "agrees with me".
> 
> 
> http://en.wikipedia.org/wiki/Uninitialized_variable
> "it is a programming error and a common source of bugs in software."
> 
> 
> And then they point out how Java requires mechanically verified initialization of locals.
> 
> The code:
> void F(bool a)
>  int i;
>  if (a)
>    i = 0;
> if (a)
>   print(i)
> 
> 
> is I believe illegal.

But it's *not* illegal in Modula 3.  You can't prohibit it without 
making a serious language change. However much we might desire to.

-- hendrik



More information about the M3devel mailing list