Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
105 Views

More than 7200 characters

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
Highlighted
105 Views

Are you also involving FPP?

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
Highlighted
Beginner
105 Views

Quote:jimdempseyatthecove

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
Highlighted
105 Views

It was unknown (to me) as to

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
Black Belt Retired Employee
105 Views

Short answer - no, there isn

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.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
105 Views

If fpp is unsuitable for your

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