Maximum number of continuation lines

Hello everyone,

not sure if this is the right place for such a basic question, sorry if that’s the case. I have been refactoring some code these days which has long hard-coded arrays with many continuation lines, so far 255 < NL < 511. So with gfortran I am getting the following warning:

Warning: Limit of 255 continuations exceeded in statement at (1)

So my question is, is it always a bad idea to have that many continuation lines? Does it harm performance? Approaches like splitting the array in several parts and then concatenating feel hacky to me.

Does the array really needs to be hard-coded? What about having the array in a separate file and reading it into the array variable?

1 Like

The warning does not mean it is a bad idea, it just marks the extension to the Fortran Standard which says:

A statement shall not have more than 255 continuation lines.

If the array constructor contains only constants, it is processed during compile time so it cannot have any impact on the performance.

1 Like

@Panadestein , it may interest you to note starting Fortran 2023 standard revision, “The limit of 255 continuation lines is removed” and instead there is a limit on the total statement length which is “a million characters.”

2 Likes

Ah yes, thanks for that. I found it some minutes ago: J3/19-138r1