[opensource-dev] Replacement class for LLDynamicArray
Brian McGroarty
soft at lindenlab.com
Fri May 9 09:20:30 PDT 2014
On Fri, May 9, 2014 at 6:37 AM, Nicky D. <sl.nicky.ml at googlemail.com> wrote:
>
>> > I notice "operator[](i)" is used in the interesting,
>>
>> With std::vector, you could also use array.at(i), which is equivalent.
>
>
> vector::at will do a runtime check if the index is out of bounds, in that
> case it throws
> an exception.
>
> vector::operator[] will not do this check, causing undefined behavior when
> accessing
> elements out of bounds.
>
Slight tweak: [] on out of bounds members is undefined, but specific
implementations may still check.
Most (maybe even all) STL implementations support bounds checking with a
compile flag. If anyone's eager to experiment, it would be nice to add that
to the debug build flags and see if debugging performance is still
tolerable on all platforms.
--
*Brian McGroarty *| Application Security, Platform Engineering
*Linden Lab* | Makers of Shared Creative Spaces <http://lindenlab.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/opensource-dev/attachments/20140509/621b8790/attachment-0001.htm
More information about the opensource-dev
mailing list