Skip to content

#848 PLCgen Fix S7-300 PLC compile problem with double negations.

Albert Hofkamp requested to merge 848-fix-plc-compile-of-unary-expression into develop

Patch adds parentheses around all unary operator applications, eg (-1) and (-(-1)). This is needed as a user may want to subtract such a value from another value, as in 5 - (- (- 1)). Improvement is possible by more careful checking the expression, but that may not be worth the effort and is not easily generalized.

For simplicity, I added the parenthesis around every unary operator. That mostly affects NOT as well. I must say val1 AND (NOT val2) does look better, but val1 := (NOT val2) doesn't.

Addresses #848 (closed)

Merge request reports