public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: preprocessor/5520: There's a warning I miss with "if{} else{}" statement
@ 2002-01-28 18:16 Carlo Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Carlo Wood @ 2002-01-28 18:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/5520; it has been noted by GNATS.

From: Carlo Wood <carlo@alinoe.com>
To: jbach1@caramail.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/5520: There's a warning I miss with "if{} else{}" statement
Date: Tue, 29 Jan 2002 03:09:21 +0100

 On Mon, Jan 28, 2002 at 11:41:20PM -0000, jbach1@caramail.com wrote:
 > I think a warning shoul be raised when someone writes
 > if (condition);
 
 Only *before* replacing macros please (if at all).
 Macros can be empty and be used like:
 if (condition)
   POSSIBLY_EMPTY_MACRO;
 
 -- 
 Carlo Wood <carlo@alinoe.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* preprocessor/5520: There's a warning I miss with "if{} else{}" statement
@ 2002-01-28 15:46 jbach1
  0 siblings, 0 replies; 2+ messages in thread
From: jbach1 @ 2002-01-28 15:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5520
>Category:       preprocessor
>Synopsis:       There's a warning I miss with "if{} else{}" statement
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 28 15:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Pierre Chatelier
>Release:        gcc 3.0.3
>Organization:
>Environment:
DOS (DJGPP)
>Description:
I think a warning shoul be raised when someone writes
if (condition);
{
}

instead of
if (condition)
{
}

(===== Watch at the ";" ====)

Actually, it can only be a mistake, and that's a pity it's not detected. It drives to severe bugs.

>How-To-Repeat:
int x=1;
if (x == 0);
{
   cout << "x equals zero" << endl;
}
>Fix:
int x=1;
if (x == 0)
{
   cout << "x equals zero" << endl;
}
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-01-29  2:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-28 18:16 preprocessor/5520: There's a warning I miss with "if{} else{}" statement Carlo Wood
  -- strict thread matches above, loose matches on Subject: below --
2002-01-28 15:46 jbach1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).