[splint-discuss] How to check Uninitialized variable

Ludolf Holzheid lholzheid at bihl-wiedemann.de
Tue May 12 10:17:22 PDT 2009


On Tue, 2009-05-12 22:27:56 +0800, Aaron Davies wrote:
> On Tue, May 12, 2009 at 9:39 PM, Ludolf Holzheid
> <lholzheid at bihl-wiedemann.de> wrote:
> > On Tue, 2009-05-12 15:16:03 +0200, Nido wrote:
> >> Here's a hack I used for another project
> >>
> >> /* Yes this is meant to be uninitialised */
> >> unsigned int seed = (unsigned int)&seed;
> >
> > Maybe you meant `seed' to be un-initialized, but you actually
> > initialized it to `some arbitrary number not equal to zero'. The same
> > could be achieved with e.g. "unsigned int seed = 17;".
> >
> > ;-)
> 
> Isn't it non-deterministic though? Given the name, I assume that's
> what he was trying to achieve.

On machines with separate (virtual) address space for each process, I
expect this to be the same value for each run. Much less deterministic
is the standard "seed = time();"-statement. This still gives no real
random numbers, but the value at least varies between program
invocations.

Ludolf

-- 

---------------------------------------------------------------
Ludolf Holzheid             Tel:    +49 621 339960
Bihl+Wiedemann GmbH         Fax:    +49 621 3392239
Floßwörthstraße 41          e-mail: lholzheid at bihl-wiedemann.de
D-68199 Mannheim, Germany
---------------------------------------------------------------



More information about the splint-discuss mailing list