comp.lang.ada
 help / color / mirror / Atom feed
From: rracine@draper.com (Roger Racine)
Subject: Uninitialized Variables
Date: 1999/01/25
Date: 1999-01-25T00:00:00+00:00	[thread overview]
Message-ID: <rracine.7.000B4B63@draper.com> (raw)

One of the few areas where Ada programs exhibit non-deterministic behavior 
(i.e. different behavior for different runs) is when variables are not set 
before their use.   

I am curious as to why the language designers did not think this was 
sufficiently common enough of an error to protect against it.  I understand 
that having an initial value takes more memory and more CPU, but so do 
constraint checks.  And there could always have been a pragma to allow 
uninitialized variables (akin to pragma SUPPRESS).

By the way, I would be happy with a mechanism at link time that  only 
complained about (or implicitly created initial values for) data that was 
determined might be used before being set. 

The problem is that different environments exhibit different behavior.  Some 
environments put zeros in all of RAM as part of initialization.  This 
sometimes masks the problem (which is fine if portability is not a concern).  
Some put zeros in all static (non-stack, non-heap) variables.  Some even allow 
the user to specify the value to be put in RAM.  And some do nothing at all.

Does anyone know why there is not at least a required link-time warning 
message for variables possibly used before being set?

Roger Racine




             reply	other threads:[~1999-01-25  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-25  0:00 Roger Racine [this message]
1999-01-25  0:00 ` Uninitialized Variables Tucker Taft
1999-01-25  0:00 ` robert_dewar
  -- strict thread matches above, loose matches on Subject: below --
2006-03-13 19:58 private types ada_student
2006-03-17  4:33 ` Justin Gombos
2006-03-17  5:17   ` Brian May
2006-03-18  1:17     ` Randy Brukardt
2006-03-18  8:39       ` Uninitialized variables (was: Re: private types) Dirk Craeynest
2006-03-18 14:06         ` Gautier
2006-03-18 14:36           ` Uninitialized variables Jeffrey Creem
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox