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

More than 7200 characters

holysword
Novice
1,321 Views

Is there any way to lift the 7200 characters per line restriction in ifort?

The reason is that I'm using some macros to avoid code duplication and they can be pretty long (whole functions sometimes).

0 Kudos
5 Replies
jimdempseyatthecove
Honored Contributor III
1,321 Views

Are you also involving FPP? If so you then have line restrictions in both Fortran and fpp.

Maybe you can use a "tiny url" approach. Copious plain text macro that expands (downwards) to cryptic unique macro name that is then used to compose a longer composite macro.

Jim Dempsey

0 Kudos
holysword
Novice
1,321 Views

jimdempseyatthecove wrote:

Are you also involving FPP? If so you then have line restrictions in both Fortran and fpp.

Maybe you can use a "tiny url" approach. Copious plain text macro that expands (downwards) to cryptic unique macro name that is then used to compose a longer composite macro.

Jim Dempsey

Yes, I am using FPP. Should I not?

Where can I find an example for this tiny url approach? Would it damage the readability of the code?

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,321 Views

It was unknown (to me) as to if fpp was used. Nothing wrong with fpp, but knowing fpp is involved adds information to your query that is necessary for meaningful discussion.

Now then:

Does the original (yourFile.f90) have a text/statement line longer than 7200 characters?
   .OR.
Due to (fpp) macro expansion(s), you generate  a text/statement line longer than 7200 characters into a temporary file for use by ifort?

And should the answer be yes to the first question, does (would) the fpp macro substitution produce a Fortran statement longer than the pre-macro substitution line?

Is the produced macro expansion

   singleFortranStatement
.OR.
   statement;statement;...;statement

Jim Dempsey

0 Kudos
Steve_Lionel
Honored Contributor III
1,321 Views

Short answer - no, there isn't a way for you to lift that restriction. I think your macro approach is unreasonable and nonportable, and would suggest seeing if introducing newlines into your macro expansion would do what you want. I have also seen people use #include for templates.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,321 Views

If fpp is unsuitable for your needs, perhaps you should consider writing your own preprocessor using AWK or other favorite programmable text editing program. Or, consider writing your preprocessor in Fortran.

Write your source program as

   YourProgram.Holysord   (multiple files too)

Then in your make file, produce a rule that converts the *.Holysord files to *.f90 files (and if you have an absurdly long expression, break it into multiple statements).

QED

Jim Dempsey

0 Kudos
Reply