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

Pre-compilation to remove all the debug tests and prints

bucaioni__thomas
New Contributor I
1,087 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,069 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,070 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,050 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,038 Views
0 Kudos
Reply