Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
No.
a = b is an assignment statement, not (like in C) an expression.
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
...
x = 11.0
a = b = c = d = x / 2.0
The gFortran 12.2.0 in Simply Fortran does not like it all.
Thanks,
Lynn
On 10/19/2021 4:28 PM, Thomas Koenig wrote:
Lynn McGuire <lynnmc...@gmail.com> schrieb:
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
No.
a = b is an assignment statement, not (like in C) an expression.Was the multiple equals usage ever legal ? I would swear that I used
this back in the Fortran IV days in the middle 1970s.
Lynn
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
...
x = 11.0
a = b = c = d = x / 2.0
The gFortran 12.2.0 in Simply Fortran does not like it all.
Thanks,
Lynn
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
...
x = 11.0
a = b = c = d = x / 2.0
The gFortran 12.2.0 in Simply Fortran does not like it all.
Thanks,
Lynn
On 10/19/21 4:27 PM, Lynn McGuire wrote:
is following code legal ?It was never standard, but was a rare-ish extension in the 60s and early 70s. It's ambiguous with something like
double precision a, b, c, d
double precision x
a = b = c = d = 0
...
x = 11.0
a = b = c = d = x / 2.0
The gFortran 12.2.0 in Simply Fortran does not like it all.
Thanks,
Lynn
R = I = 3.14
Should R be 3 or 3.14?
Dick Hendrickson
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
...
x = 11.0
a = b = c = d = x / 2.0
The gFortran 12.2.0 in Simply Fortran does not like it all.
Thanks,
Lynn
is following code legal ?.
double precision a, b, c, d
double precision x
a = b = c = d = 0
...
x = 11.0
a = b = c = d = x / 2.0
The gFortran 12.2.0 in Simply Fortran does not like it all.
On 10/19/2021 4:27 PM, Lynn McGuire wrote:
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
...
x = 11.0
a = b = c = d = x / 2.0
The gFortran 12.2.0 in Simply Fortran does not like it all.
Thanks,
Lynn
From Open Watcom FORTRAN 77 Language Reference:
https://www.os2site.com/sw/dev/openwatcom/manuals/f77lr.pdf
8.6 Extended Assignment Statement
Open Watcom FORTRAN 77 supports an extension to the FORTRAN 77
assignment statement, namely
the extended assignment statement.
v = v = v = ... = v = e
1 2 3 n
where:
v’i must be one of the following:
1. Variable names or array element names of type INTEGER, REAL, DOUBLE PRECISION, COMPLEX or double precision complex (COMPLEX*16).
2. Variable names or array element names of type LOGICAL.
3. Character variable names, character array elements, or character substrings.
e must be one of the following and must follow the rules of the
arithmetic, logical or character
assignment statements:
1. An arithmetic expression.
2. A logical expression.
3. A character expression.
The extended assignment statement is equivalent to the following
individual statements.
v = e
n
v = v
n-1 n
.
.
.
v = v
2 3
v = v
1 2
Thanks,
Lynn
On Wednesday, October 20, 2021 at 8:27:15 AM UTC+11, Lynn McGuire wrote:
is following code legal ?.
No.
The fragment is not even legal in PL/I, which does allow multiple assignments.
Its assignments are of the form
a, b, c, ... z = expression;
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
...
x = 11.0
a = b = c = d = x / 2.0
The gFortran 12.2.0 in Simply Fortran does not like it all.
Thanks,
Lynn
is following code legal ?
double precision a, b, c, d
double precision x
a = b = c = d = 0
...
x = 11.0
a = b = c = d = x / 2.0
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 159 |
Nodes: | 16 (0 / 16) |
Uptime: | 98:44:33 |
Calls: | 3,209 |
Files: | 10,563 |
Messages: | 3,009,783 |