Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29284 Discussions

Preprocessor directive for fpp variable and macro definitions

Gert__Godfree
Beginner
463 Views

I am trying to use the Fortran preprocessor directives to print the unit numbers (this is sometimes a constant and sometimes a variable) used in all the write statements in my code. This requires me to redefine the write keyword as well as its first argument. My code compiles successfully with the following:

#define write write(*,*) 'WRITE STATEMENT: '//__FILE__, __LINE__; write

I would however like to add the unit number to this and was thinking of using

#define write(a,b) write(*,*) 'WRITE STATEMENT: '//__FILE__, __LINE__,a ; write(a,b)

but I run in to problems when compiler runs into lines that originally had "write(*"

Is there any way to avoid "write(*" but still catch "write(n,".

 

Thanks.

0 Kudos
0 Replies
Reply