- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
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 ?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, ok, but that only works for fixed-form source.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page