preprocessor/5520: There's a warning I miss with "if{} else{}" statement
jbach1@caramail.com
jbach1@caramail.com
Mon Jan 28 15:46:00 GMT 2002
>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:
More information about the Gcc-prs
mailing list