Kiran Jadhav
Kiran Jadhav

Reputation: 11

Unary operator following arithmetic operator (use parentheses) at (1)

When I am compiling a Fortran Code I am getting the following warning:

nse3dmpi_subs.f:603:15:

  .        -HALF*aimag(k3(k)*(uh(i,j,k,1)*conjg(uconv3h(i,j,k,1))-
           1

Warning: Extension: Unary operator following arithmetic operator (use parentheses) at (1)

How do I get rid of the warning?

Upvotes: 0

Views: 1829

Answers (1)

bob.sacamento
bob.sacamento

Reputation: 6661

I got the exact same error recently. It happened because I ended one line with "+", did a line continuation, and started the next line with "-". I got rid of it by taking the "-" out of the second line and replacing the "+" with a "-". Instead of:

      x = (really long expression) +
     1      -2.*(other long expression)

I needed:

      x = (really long expression) -
     1     2.*(other long expression)

Alternatively, I could have done:

      x = (really long expression) +
     1      (-2.*(other long expression))

Upvotes: 2

Related Questions