[M3devel] warning for uninitialized variables?

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Fri Jun 4 01:41:02 CEST 2010


On Wed, Jun 02, 2010 at 12:59:45PM +0000, Jay K wrote:
> 
> I grant that an immediate runtime error upon reading an unwritten value is ideal.

One of the variables in a cryptographic-quality random number generator 
was uninitialized.  Someone in Debian "fixed" that.  The random number 
generator was n longer of cryptographic quality.  It turns out is was 
relying on the variable being garbage.

So we still need to be able to use uninitialized stuff..  But not by 
accident.

> But absent that possibility, I want something consistent.
> Heck, here's a crazy idea: reserve the current FIRST(INTEGER) as 
> "invalid", initialize locals to it, any read (or generation/write) of 
> that value trigger a runtime error.
> CARDINAL could work this way more easily since it has many values to spare.

And if instead of a load, your machine had a load absolute value, a 
hardware overflow trap could catch the error at no additional run time.
That's a hack I planned to use for a NULL check on an IBM 360 long long 
ago.

-- hendrik



More information about the M3devel mailing list