[PATCH] Fix PR libstdc++/19510: Uninitialized variable in some iterators

Chris Jefferson caj@cs.york.ac.uk
Thu Jan 20 13:44:00 GMT 2005


Gabriel Dos Reis wrote:

>Chris Jefferson <caj@cs.york.ac.uk> writes:
>
>[...]
>
>| >We have a default-initialisation (to zero in this case), rather than an
>| >indeterminate value. IMHO any slight overhead is worth it.
>| >
>| Hmm.. I would tend to say the "C++" way was to never default initalise
>
>well, that is not "C++" way.  That is something inherited from C, and
>preseved there more for inertia or alleged efficiency of POD in
>general than in specific cases at hand.  Here we're talking about
>inline initialization of a class member.  I also see no reason to dump
>annoying messages on users about which he/she can do nothing.
>
>
>How do you know under the debugger that a list iterator is singular?
>Do you prefer to see a null pointer value or some values you cannot
>say off hand are valid or not?
>
>  
>
To be honest, I perfer to initalise these things :)

However, with regards sending this back to 3.4, I'm not convinced it's 
an actual bug, although it is likely to lead to more informative 
debugging / less memory corruption (no-one should be counting on the 
iterator pointing at NULL of course). However if it is in fact safe to 
send back there as you say, I don't see why not.

Chris



More information about the Libstdc++ mailing list