Reputation: 39
Any body can explain to me why identify the '+' on second line as an unary operator?
b=(x_temp(i+1,j)-x_temp(i-1,j))*(x_temp(i,j+1)-x_temp(i,j-1))/4
> +(y_temp(i+1,j)-y_temp(i-1,j))
> *(y_temp(i,j+1)-y_temp(i,j-1))/4
Upvotes: 0
Views: 735
Reputation: 882596
Assuming your question is "why does this code compile with a unary +
operator there, it's not actually a unary operator, it's a binary one as the first character of a continuation line.
The >
characters are almost certainly in column 6 to indicate that the last two lines are continuations of the first.
Hence the entire expression is effectively:
b=(x_temp(i+1,j)-x_temp(i-1,j))*(x_temp(i,j+1)-x_temp(i,j-1))/4+(y_temp(i+1,j)-y_temp(i-1,j))*(y_temp(i,j+1)-y_temp(i,j-1))/4
If your question is more "why is my compiler not recognising the line continuation?", it may be that it's expecting you to follow free-format rules, using &
at the end of the line being continued and/or &
as the first non-blank character in the continuation line.
That's the newer style, Fortran77 followed the older style. You may have to find out which compiler options will force your compiler to recognise the older style.
Upvotes: 2