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

!DEC$ DEFINE

jaeger0
Beginner
1,411 Views
I want to make som special handing for each function in debug mode.
So I found the !DEC$ DEFINE,

I want to do that in each subroutine of my programm.
So I don't want to make a Flag like,

if (debug) then
dump (variables)
edif

sice I need that only in debug mode, an I want to minimize computational costs.
The problem of the !DEC$ DEFINE is that is only local. I want to make a global flag debug. If the flag is set, the compiler should make the code, with all debug-handling, and the simple code if I dont set this debug flag.

I could define "!DEC$ DEFINE DEBUG" in each source file, but, then it's tedious to swicht the flag on or of for all files.

Is there any posibility to make such a global flag, in the !DEC% DEFINE mode ?


0 Kudos
1 Solution
Steven_L_Intel1
Employee
1,411 Views
Typically the way this is handled is to add a _DEBUG symbol name in the Project > Fortran > Preprocessor property page for the Debug configuration. You can then test this with !DEC$ IF DEFINED (_DEBUG) in your source. Read the documentation on preprocessing for more details. Note that if you use the !DEC$ style, you don't have to explicitly enable preprocessing as these are handled directly by the compiler.

View solution in original post

0 Kudos
3 Replies
Steven_L_Intel1
Employee
1,412 Views
Typically the way this is handled is to add a _DEBUG symbol name in the Project > Fortran > Preprocessor property page for the Debug configuration. You can then test this with !DEC$ IF DEFINED (_DEBUG) in your source. Read the documentation on preprocessing for more details. Note that if you use the !DEC$ style, you don't have to explicitly enable preprocessing as these are handled directly by the compiler.
0 Kudos
engineerik
Beginner
1,411 Views
Typically the way this is handled is to add a _DEBUG symbol name in the Project > Fortran > Preprocessor property page for the Debug configuration. You can then test this with !DEC$ IF DEFINED (_DEBUG) in your source. Read the documentation on preprocessing for more details. Note that if you use the !DEC$ style, you don't have to explicitly enable preprocessing as these are handled directly by the compiler.

I find it real handy to set the option to compile lines of code with a D in column 1 for debug but not for release.
Fast and easy!

Regards,
Erik
0 Kudos
Steven_L_Intel1
Employee
1,411 Views
Well, ok, but that only works for fixed-form source.
0 Kudos
Reply