Feature request/idea: flag to initialize with NaN.
Paul Brook
paul@codesourcery.com
Sun Aug 14 16:37:00 GMT 2005
On Saturday 13 August 2005 04:53, Brooks Moses wrote:
> On comp.lang.fortran, there was a thread about detecting undefined (as
> opposed to undeclared) variables, and Richard Edgar made a suggestion
> that it would be useful for purposes of tracking down these errors to
> automatically assign "silly values" -- e.g., NaN for floating-point
> numbers, and HUGE to integers -- to all variables upon declaration.
>
> I suspect this is likely to be inappropriate to do in the general case,
> as it requires actually touching the memory for every cell of large
> arrays upon declaration, and thus is a bit of a performance hit.
> However, I would think it to be useful enough that it's worth including
> as an option with a compile-time flag.
>
> Thoughts?
This seems reasonable. The only problem would be with large common
blocks/module variables. You probably need to fix PR19925 first.
Note that g77 has -finit-local-zero. This is effectively the same thing, but
initializes with zeros. You'd probably want to implement both at the same
time.
Paul
More information about the Fortran
mailing list