This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]