Skip to main content
Question Unprotected by user3840170
Question Protected by user3840170
tag, grammar (swapped adjective for a noun), contemporaneous (unless you really meant modern?)
Source Link
user3840170
  • 23.2k
  • 4
  • 92
  • 150

Occasionally I have heard references to a peculiarpeculiarity of certain (old) Fortran compilers, with regards to subprogram argument passing. Here is an example, from an answer to a Stack Overflow question:

Some early Fortran compilers implemented constants by using a constant pool. All parameters were passed by reference. If you called a function, e.g.

f(1)

The compiler would pass the address of the constant 1 in the constant pool to the function. If you assigned a value to the parameter in the function, you would change the value (in this case the value of 1) globally in the program. Caused some head scratching.

The C FAQ also mentions “FORTRAN's classic idiosyncrasy involving constants passed by reference” in a footnote.

I have no problem believing that some compilers behaved this way. However, I would like to have some contemporarycontemporaneous documents that confirm it. The nature of the document doesn't matter too much; I merely want confirmation from a non-anecdotal source (although some kind of manual would be ideal).

Occasionally I have heard references to a peculiar of certain (old) Fortran compilers, with regards to subprogram argument passing. Here is an example, from an answer to a Stack Overflow question:

Some early Fortran compilers implemented constants by using a constant pool. All parameters were passed by reference. If you called a function, e.g.

f(1)

The compiler would pass the address of the constant 1 in the constant pool to the function. If you assigned a value to the parameter in the function, you would change the value (in this case the value of 1) globally in the program. Caused some head scratching.

The C FAQ also mentions “FORTRAN's classic idiosyncrasy involving constants passed by reference” in a footnote.

I have no problem believing that some compilers behaved this way. However, I would like to have some contemporary documents that confirm it. The nature of the document doesn't matter too much; I merely want confirmation from a non-anecdotal source (although some kind of manual would be ideal).

Occasionally I have heard references to a peculiarity of certain (old) Fortran compilers, with regards to subprogram argument passing. Here is an example, from an answer to a Stack Overflow question:

Some early Fortran compilers implemented constants by using a constant pool. All parameters were passed by reference. If you called a function, e.g.

f(1)

The compiler would pass the address of the constant 1 in the constant pool to the function. If you assigned a value to the parameter in the function, you would change the value (in this case the value of 1) globally in the program. Caused some head scratching.

The C FAQ also mentions “FORTRAN's classic idiosyncrasy involving constants passed by reference” in a footnote.

I have no problem believing that some compilers behaved this way. However, I would like to have some contemporaneous documents that confirm it. The nature of the document doesn't matter too much; I merely want confirmation from a non-anecdotal source (although some kind of manual would be ideal).

Source Link
texdr.aft
  • 3.6k
  • 1
  • 19
  • 42

Are there any primary sources for the “passing constant by reference” behavior in old Fortran compilers?

Occasionally I have heard references to a peculiar of certain (old) Fortran compilers, with regards to subprogram argument passing. Here is an example, from an answer to a Stack Overflow question:

Some early Fortran compilers implemented constants by using a constant pool. All parameters were passed by reference. If you called a function, e.g.

f(1)

The compiler would pass the address of the constant 1 in the constant pool to the function. If you assigned a value to the parameter in the function, you would change the value (in this case the value of 1) globally in the program. Caused some head scratching.

The C FAQ also mentions “FORTRAN's classic idiosyncrasy involving constants passed by reference” in a footnote.

I have no problem believing that some compilers behaved this way. However, I would like to have some contemporary documents that confirm it. The nature of the document doesn't matter too much; I merely want confirmation from a non-anecdotal source (although some kind of manual would be ideal).