[Bug c++/47686] scope of variables declared within a nested for loop is trivial

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 10 22:41:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47686

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-02-10 21:30:57 UTC ---
Of course the same memory location is used, it's at a predictable location on
the stack. If you want it to be cleared, then initialize it, don't expect the
compiler to do so.

If you want code that 'seems right' then write code that conforms to the rules
of the language.



More information about the Gcc-bugs mailing list