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

preprocessor question

tracyx
New Contributor I
982 Views

hi, i am using ifort with fpp. i have a preprocessor directive of the form:

#define pop%me 1

i would like this to replace occurances of "pop%me" with "1". However, it is replacing "pop" with "%me 1". Can anybody suggest a work around to this problem?

thanks!

0 Kudos
3 Replies
Steven_L_Intel1
Employee
982 Views

% is not a valid character in identifiers, even in the preprocessor. Try pop_me instead or pop$me.

0 Kudos
tracyx
New Contributor I
982 Views

% is not a valid character in identifiers, even in the preprocessor. Try pop_me instead or pop$me.

thanks for your reply. i was trying to replace derived type conditional statements in some source code with a constant expression, and then letting the optimizer take care of them (removing them gives ~5% performance increase). in my particular usage of this source i know this condition will always be true, but it is not in more general applications. i had hoped that a simple use of the preprocessoer would have allowed me to just maintain a single version of the code, but i'm now guessing this is not possible...

0 Kudos
jimdempseyatthecove
Honored Contributor III
982 Views


Invert your FPP usage.

#if 0
#define POP_ME pop%me
#else
#define POP_ME 1
#endif

Then use POP_ME in the source code.

Jim Dempsey

0 Kudos
Reply