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

Gabriel Dos Reis gdr@integrable-solutions.net
Thu Jan 20 16:11:00 GMT 2005



This is exhausting when you can lookup the answer.

Chris Jefferson <caj@cs.york.ac.uk> writes:

[...]

| > | | struct ptrwrapper {
| >| int* a;
| >| ptrwrapper() {}
| >| };
| > | | std::vector<ptrwrapper> v(1);
| >
| >
| >That is an error in the class ptrwrapper.  Failing to initialise
| >ptrwrapper::a results in undefined behaviour when you use it.
| >
| But where am I "using" a? 


   vector(size_type n, const T& value = T(), const Allocator& = Allocator());

| How this is this significantly different
| from the code:
| 
| int i=10;
| int *a=&ci;
| int* b;
| a=b;

That is not what you're doing.

-- Gaby



More information about the Libstdc++ mailing list