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

Looking for something like ASSERT of VC++

trejbal
Beginner
316 Views
Sorry for the following stupid question. I am a C++ programmer and have to write a bit of Fortran code.
I am using CFV 6.1A and looking for something like ASSERT of VC++ - i.e. I want to write a condition in the code and if it is not met the debugger should stop the execution at this point so I can walk through the stack watch variables, etc.
0 Kudos
2 Replies
rahzan
Novice
316 Views
I think there is a way to do this, using /define or via the "predefined preprocessor symbols" under, Project, setting, Fortran.

I think you define something which is true only in the DEBUG mode and then condition on it to do other things.

I have done something like this a longtime ago but can't remember exactly how. I do not think that it will be difficult.

Tim
0 Kudos
rahzan
Novice
316 Views
Ok I had to look it up:
put in a name like DEBUG in the text box for the predefined preprocessor variables in the fortran Tab of the project settings.

Make sure this is done ONLY for the Debug config.

Then in the code write

!dec$ if defined (DEBUG)
if(...) !this will now act like ASSERT
... do whatever
!dec$ endif

Tim
0 Kudos
Reply