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

!DEC$ DEFINE

jaeger0
初学者
1,952 次查看
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 项奖励
1 解答
Steven_L_Intel1
1,952 次查看
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 项奖励
3 回复数
Steven_L_Intel1
1,953 次查看
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 项奖励
engineerik
初学者
1,952 次查看
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 项奖励
Steven_L_Intel1
1,952 次查看
Well, ok, but that only works for fixed-form source.
0 项奖励
回复