On Wed, Nov 06, 2002 at 01:57:34AM +0100, Frank Heckenbach wrote:
Eike Lange wrote: As has shown already in this thread, not all programms consider an empty `else' part a bug. Actually, there's one situation where I can imagine it to be useful, the dangling `else' problem: if foo then if bar then baz else else qux Though alternatively, one can use `begin'/`end' to avoid the empty `else' part: if foo then begin if bar then baz end else qux
The latter looks quite more natural to me (and is the way, the GPCS prefers). IMO using a comment instead of an empty `else' statement makes the first example more readable:
if foo then if bar then baz else { empty } else qux
Warnings and empty `else' might be a topic for "GNU Pascal Coding Standard (* Assorted Tips )" if you agree.
Eike