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

Pre-compilation to remove all the debug tests and prints

bucaioni__thomas
New Contributor I
1,084 Views

Is there a pre-compilation phase to remove all the debug tests, for example:

# PRE_COMPIL_FLAG_BEGIN
print *, "Check of variable V: V = ", V
if (V.le.0) then
print *, "Bug"
stop
end if
# PRE_COMPIL_FLAG_END

and when compiling for optimized execution, having all these lines removed?

0 Kudos
1 Solution
Arjen_Markus
Honored Contributor I
1,066 Views

You can use the preprocessor step for this, this is typically done via:

#ifdef PRE_COMPIL_FLAG
your debug code
#endif

 For this to work you need to specify the compile option /fpp (in VS it is the first option under "Preprocessor")

View solution in original post

0 Kudos
3 Replies
Arjen_Markus
Honored Contributor I
1,067 Views

You can use the preprocessor step for this, this is typically done via:

#ifdef PRE_COMPIL_FLAG
your debug code
#endif

 For this to work you need to specify the compile option /fpp (in VS it is the first option under "Preprocessor")

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,047 Views

Or use:

!dir$ if defined(PRE_COMPIL_FLAG)
your debug code
!dir$ endif 

Then you do not need to use fpp.

Jim Dempsey

bucaioni__thomas
New Contributor I
1,035 Views
0 Kudos
Reply