int nan

superdan super at dan.org
Sat Jun 27 08:14:57 PDT 2009


Michiel Helvensteijn Wrote:

> BCS wrote:
> 
> >> Interesting idea, but IMO using NaN as a default initializer is just a
> >> crutch for not having a real system of compile-time
> >> detecting/preventing of uninitialized variables from being read (C#'s
> >> system for this works very well in my experience).
> > 
> > I think you can prove that it is impossible to do this totally correctly:
> > 
> > int i;
> > 
> > for(int j = foo(); j > 0; j--) i = bar(j);   // what if foo() returns -5?
> 
> Complete static analysis of the flow of program control is the holy grail of
> compiler construction. It would allow automatic proof of many program
> properties (such as initialization). It may not be impossible, but it is
> extremely complicated.

extremely complicated? it's machine haltin' dood.




More information about the Digitalmars-d mailing list