On Tue, May 6, 2008 at 6:33 PM, Xavier Delacour
<[EMAIL PROTECTED]> wrote:
> buf[sz] like this shouldn't dereference buf[sz].
I'm not following this sentence....
> Maybe it's a
> difference between MS and gcc STL implementations (though I thought it
> was standard.. do you have a segfault at this point?). buf[sz] ought
> to return a reference, &buf[sz] converts it to a pointer.
Indeed, I get a segfault at this point. When debugging, I see that
vector<T>::operator[] is really executed with an out-of-bound index.
And this really dereference and invalid memory location. If you look
into MSVC header you find something like:
reference operator[](size_type _Pos)
{ // subscript mutable sequence
return (*(_Myfirst + _Pos));
}
Michael.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev