🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53282

new warning "empty else" in 2.0?

#53282
From: Uwe Geuder
Date: Tue, 25 Feb 1992 16:28
32 lines
1607 bytes
When compiling with -W I receive the warning "empty body in an
else-statement" (this seems to be an "improvement" since 1.40). I'm
using empty else-statements intentionally in order to resolve dangling
else situations.

  if ( a )
    if ( b )
      do_this ;
    else
      ; 
  else
    do_that ;

-W is included in -Wall. The documentation says

     The remaining `-W...' options are not implied by `-Wall' because
  they warn about constructions that we consider reasonable to use, on
  occasion, in clean programs.

So I must conclude that my usage is unreasonable for a clean program.
(Of course I know how to achieve dangling else resolution on a
different way. But the mere existence of an alternative should not
deem everything else unreasonable). Can anybody explain?

BTW I could not find any documentation for this new warning. -W
description seems not to mention it. What did I overlook?

Regards,

Uwe
--
Uwe Geuder, geuder@informatik.uni-stuttgart.de
Technical Details
Message-ID: <GEUDER.92Feb25172843@priamos.informatik.uni-stuttgart.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!news.belwue.de!rusmv1!ifistg!ifi!geuder

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,e9f0a41cde6987e8,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1992-02-25 09:37:26 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!news.belwue.de!rusmv1!ifistg!ifi!geuder
From: geuder@informatik.uni-stuttgart.de (Uwe Geuder)
Newsgroups: gnu.gcc.help
Subject: new warning "empty else" in 2.0?
Message-ID: <GEUDER.92Feb25172843@priamos.informatik.uni-stuttgart.de>
Date: 25 Feb 92 16:28:43 GMT
Sender: news@ifistg.uucp
Organization: IPVR, Stuttgart University, Germany
Lines: 32