[opensource-dev] Replacement class for LLDynamicArray

Nicky D. sl.nicky.ml at googlemail.com
Fri May 9 08:43:34 PDT 2014


>
> True, but on the other hand, you'd never call array[i] with i out of
> array bound (it would be a bug, and throwing an exception via the use
> of at(i) is no better than "undefined behaviour"

that will also lead to a crash in the end).


Wrong. See Heartbleed.  It depends on if the page behind the last element
is valid and how you use the memory. That's why it is undefined. Because
no one can say.
The exception at least would have terminated the buggy code and not sent
private sessions keys to someone else.
It's buggy no matter what, agreed to that. But at at least in one case it
goes
down right away without happily processing whatever data first.

The fact that array[i] doesn't check the upper
> bound also makes it faster than array.at(i): competent programmers who
> do check for bounds where actually needed will therefore prefer
> array[i] to array.at(i), esspecially when used in a loop !


Agreed.

Nicky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/opensource-dev/attachments/20140509/9f064e94/attachment.htm 


More information about the opensource-dev mailing list