frank at g-n-u.de
Mon Apr 21 03:24:31 CEST 2003
GCC supports `-Wparentheses' (warn about some constructs where
parentheses are suggested for clarification, although not strictly
syntactically necessary). The corresponding code is also there for
GPC. I'm going to activate it now. The questions are:
- Which constructs to warn about? So far, I've come up with the
* `and' in an operand of `or', as in `a or b and c' which is
equivalent to `a or (b and c)', but may confuse the reader.
(Same for `and_then' instead of `and' etc., of course.)
* logical operations (`and', `or', `not', etc.) in an operand of a
relational operator (`=', etc., `in'). This would catch cases
like the dreaded `if not a = b'.
- What should be the default? I suggest off by default and on with
`-Wall' (same as in GCC).
(Of course, the issue is not as serious in Pascal than it is in C
where the danger of confusion between `==' and `=' in a comparison
almost requires such a warning, but I think it's also useful in
Frank Heckenbach, frank at g-n-u.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
GPC download signing key: 51FF C1F0 1A77 C6C2 4482 4DDC 117A 9773 7F88 1707
More information about the Gpc