- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran can not yet detect unitialised components so here is a good way to do this. It only works for floating point and not allocatable arrays. You will find NaN will spread from any calculation using an unitialized variable. It is a bit like the existing compiler option to Initialise to an unusual value, but better. It would be nice if Intel changed that option to use NaN for floats.
Define a paramemeter such as "DEBUG" in the debug configuration but not the release configuration, then use the following way to define real components:
module BearingMod
implicit none
real, parameter :: aNaN = 0.0/0.0
type BearingRow
!DEC$ if defined(DEBUG)
real :: ballDiameter = aNaN
real :: clearance = aNaN
!DEC$ else
real :: ballDiameter
real :: clearance
!DEC$ end if
end type
end module
Define a paramemeter such as "DEBUG" in the debug configuration but not the release configuration, then use the following way to define real components:
module BearingMod
implicit none
real, parameter :: aNaN = 0.0/0.0
type BearingRow
!DEC$ if defined(DEBUG)
real :: ballDiameter = aNaN
real :: clearance = aNaN
!DEC$ else
real :: ballDiameter
real :: clearance
!DEC$ end if
end type
end module
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page