This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
preprocessor/5520: There's a warning I miss with "if{} else{}" statement
- From: jbach1 at caramail dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 28 Jan 2002 23:41:20 -0000
- Subject: preprocessor/5520: There's a warning I miss with "if{} else{}" statement
- Reply-to: jbach1 at caramail dot com
>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: