Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

initialize undefined variables

Morgan_L_
Beginner
345 Views

Having uninitialized variables is, of course, poor practice but inevitable.  Using options like Qzero is not much better.  Zero is too forgiving.  On legacy hardware (e.g., CDC 7600) I would always preset memory to infinite or indefinite values because the use of such values in ANY arithmetic operation immediately threw a MODE error.  The question is then twofold:

(1) is there a way to set undefined variables scalars and arrays to a characteristic value that if used in an arithmetic operation will cause an immediate error, and

(2) what is a hex value that will result in such behavior.

0 Kudos
1 Reply
Steven_L_Intel1
Employee
345 Views

The only choice we offer here is zero or, for floating point, a "signaling NaN", For integers, zero is your only option. /init:snan /init:arrays is probably what you want (but this requires a current version.)

0 Kudos
Reply