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

Looking for something like ASSERT of VC++

trejbal
初学者
586 次查看
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 项奖励
2 回复数
rahzan
新分销商 I
586 次查看
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 项奖励
rahzan
新分销商 I
586 次查看
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 项奖励
回复