This is the mail archive of the
mailing list for the libstdc++ project.
Re: [PATCH] Fix PR libstdc++/19510: Uninitialized variable in some iterators
Nathan Myers <email@example.com> writes:
| At the last meeting I attended, there was serious talk about adding a
| requirement that default construction be required to zero native types,
| identically as for static objects. I don't know if it went anywhere.
I think it is still on the list of things ("embarassments") to remove
from the language. Of course, that would require care and long debates :-)
| If that happened, then I think the language would not have any cases
| of values that can be copied, but with undefined results.
There is another aspect that did not occur to me until Sylvain Pion
(INRIA Sophia Antipolis) pointed it to me, four months ago.
>From the perspective that iterators are "generalizations" of pointers,
there is a missing value, the analogous of null pointer and its
ability to serve as "sentinal" or special (not singular) value.
If T is a pointer type, then T() is a null pointer and it can be used
as a special value. That guarantee is missing for general iterators.
I hope Sylvain would step in and explain the various occasions where
that irregularity gets into the way.