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

fpp #define case-sensitive, not explicitly in docs?

MWind2
New Contributor III
1,540 Views

After getting used to upper and lowercase equivalence, it took a bit to realize #define <macro> <value> was case sensitive in use as in:

do i=1, MACRO

does not work.

If right, it would have been a nice addition to fpp docs.

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
1,540 Views

FPP is not Fortran, you could, if you wish, use CPP to preprocess the file.

I find it helpful to make use of case sensitivity to correct bugs in the compiler/runtime library.

Assume there is a flaky RTL function (or a function currently not suitable), call it FOOBAR, which in Fortran you can use foobar (case insensitive). When I have found issues with a library function and wish to make a correction, I may choose to use fOoBaR in the source code and then by using FPP and #define or not having a #define, or not using FPP, the same code will compile and selectively choose the desired function. This done without having to insert !DIR$ IF .... conditional code, and then later going back to remove the ugliness from the code.

Make lemonade.

Jim Dempsey

0 Kudos
MWind2
New Contributor III
1,540 Views

It just took me what seemed like a long time to figure out what was wrong with my first use of the ifort fpp with a simple #define IXSIZE (16)" to use in an array length and a do loop.

That is an interesting use of the fpp. Thanks.  

0 Kudos
Reply