This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/42795] false "statement has no effect" message
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jan 2010 03:01:25 -0000
- Subject: [Bug c/42795] false "statement has no effect" message
- References: <bug-42795-16785@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from pinskia at gcc dot gnu dot org 2010-01-19 03:01 -------
(In reply to comment #3)
> So setting a variable as the coder desires is no effect? Some would disagree.
>
> A statement that really would not have an effect would be:
>
> if (theworldis > notenough);
No that is not is being warned about. The statement that is being warned about
is just "i;" which is the same inside a for statement as it is outside one.
Both are statements have no effect as it does nothing.
Take:
void f(int i)
{
i;
}
Do you think that should be warned about? That is the exact same thing which
is being warned about when you have:
void f(int i)
{
for(i; .... ; ....)
....
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42795