Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7942429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:58:03+00:00 2026-06-03T23:58:03+00:00

I came across some code today that looks like this: subroutine sub(hello,world,this,routine,takes,a, & &

  • 0

I came across some code today that looks like this:

      subroutine sub(hello,world,this,routine,takes,a, &
     &   crazy,large,number,of,arguments,              &
     &   so,many,that,it,gets,split,across,four,       &
     &   lines)

It seems that the ampersands in the 5th column are in case the user
wants to compile the code with a f77 compiler — My question is whether
this is legitimate (standard conforming) fortran 90 code. I suppose that
it probably isn’t standard conforming f77 code since the trailing ampersands
aren’t in column 73 either…but if they were, would this be a standard way to make free-format and fixed-format compilers happy? In other words, does the fortran 90 standard say that &’s in the middle of a line are simply ignored (or something to that effect)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:58:05+00:00Added an answer on June 3, 2026 at 11:58 pm

    The & is the Fortran 90 free-form continuation character. The compiler will behave as if the lines are concatenated by matching the location of the trailing & with the leading & on the next line. Since Fortran is happy to ignore spaces between tokens what you have posted is a way of writing a very long statement across a number of source file lines. (OP probably already knows all this, other readers may not.)

    The snippet you show is definitely standard-conforming Fortran 90. The standard defines a trailing & to be the continuation character. If you want to split either a token (such as a variable name) or a ‘character-context’ (such as a string literal) across lines then the line onto which the continuation runs must start with an & and there must be no blanks inserted into the sequence of characters after the line-starting &. I think that what you have posted sneaks into standard-conformity on the grounds that the successive &s might be considered to be not introducing any whitespace into the existing whitespace.

    However, the line-starting &s are not required in your snippet.

    Your snippet is definitely not standard-conforming fixed-format FORTRAN77. However, most modern Fortran compilers will, unless you instruct them otherwise, take a relaxed view of this sort of ‘not-standard-conforming’ but ‘obvious-what-is-meant’ code and compile it quite happily. Unless, that is, you try something odd like adding free-format code into an existing fixed-format source file, that’s just asking for the compiler to have a hissy fit.

    EDIT

    My original answer failed to answer OP’s question relating to moving the &s into the 73rd column as a tactic for creating code to keep fixed- and free-form compilation happy. In FORTRAN77 continuation is marked by a character (any character) in column 6 of the continuing line. That version of the language did not require any character at the end of the line being continued. Again, I can’t see anything wrong with putting an & in column 73. As OP pointed out in a comment, fixed-form Fortran ignores any characters in col 73-80, and punched cards (ahh, happy days) had only 80 columns.

    But I can’t see anything to recommend this approach either. I think that it is far preferable not to mix free- and fixed-form in the same source file. All the current Fortran compilers will compile both forms in the same compilation. But if you want to go ahead and mix the two, feel free to do so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently came across some code that looks something like this: <head> <?php /*
I came across some code written in C that looks like this: if (file
I came across some legacy code that contains a function like this: LPCTSTR returnString()
I recently came across some code like this: parent && parent.removeChild(this); Which takes the
So I came across some code this morning that looked like this: try {
Context I came across some code, like this: if( Some_Condition ) throw 0; I
I came across some code today that surprised me. A variable was defined (outside
I came across this piece of code today while tutoring some students in a
I came across some code like this: public string IsAdmin() { string style =
Today i was writing some heavy reflection-using code, and i came across this behavior

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.