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

Pre-compilation to remove all the debug tests and prints

bucaioni__thomas
New Contributor I
427 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
Valued Contributor III
409 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

3 Replies
Arjen_Markus
Valued Contributor III
410 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")

jimdempseyatthecove
Black Belt
390 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
378 Views
Reply