This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: warning that warns about iso compliant code
- From: "Atwood, Robert C" <r dot atwood at imperial dot ac dot uk>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 2 May 2008 12:55:37 +0100
- Subject: RE: warning that warns about iso compliant code
- References: <4819C3FF.9060200@kitware.com>
> -----Original Message-----
On Behalf Of Burlen Loring
> Sent: 01 May 2008 14:22
...
> testNetsted.cpp:4: warning: matches this 'i' under ISO standard rules
> testNetsted.cpp:7: warning: matches this 'i' under old rules
>
> To me it seems the compiler should not warn about code that
> follows the
> ISO standard rules. However, it would be nice if the compiler warned
> about the case that didn't follow the standard.
I don't see how the compiler could know when someone intended to use the
old rules? So how could it know which 'case' this example is?
Until someone implements the DWIM directive ;-0.
So though I did not even know about the 'old rules' I would agree with
Scott (me22) that as long as someone might have learned the old rules,
and come back from not programming c++ for a while, a warning for this
is not a bad idea.
I also would have been told by my teachers that this is poor and
errorprone style, opinions may differ, I don't even like declaring loop
variables inside the for() .. Because I use c mostly ..