RE: Uninitialized Variables
- Posted by Bernie Ryan <xotron at localnet.com> Mar 23, 2002
- 493 views
Chris Bensler wrote: > I have thought of a way that we can determine if a variable is > uninitialized or not. We can also set it back to being uninitialized. > > constant INF = (1e300*1e300), > > integer i i = -INF > atom a a = -INF > sequence s s = INF > object o o = INF > > I tried to use NAN as well, but everything is equal to NAN!? > NAN=1 > NAN=-NAN > NAN=INF > NAN=-5039487 > > Is that proper behaviour? > Chris: I don't think you understand what a uninitialized variable is. When a compiler or interpreter allocates a storage location to contain a variable. There is know way to know what that memory location contains. The variable is therefore called a unintialized variable. If the compiler or interpreter assigns a known value at creation time, then the variable is called a initialized variable. What you are doing above is assigning a known value to a uninitialized variable. Bernie