Slincing behaviour

Simon s.d.hammett at gmail.com
Fri Nov 11 13:10:12 PST 2011


On 11/11/2011 19:04, Steven Schveighoffer wrote:
> On Fri, 11 Nov 2011 14:01:42 -0500, Steven Schveighoffer
> <schveiguy at yahoo.com> wrote:
>
>> There should be no bounds error in any case, an empty slice is valid.
>
> By "in any case" I meant in either debug or release mode.
>
> -Steve

even when you index beyond the bounds of the slice?

you may not actually be reading memory because it's zero length, but 
it's still logically invalid; you've gone outside the valid range.

in vc9, if you increment an iterator beyond the valid range you get a 
debug assert. that's caught quite a few bugs where I work when we 
upgraded to vc9.

-- 
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk


More information about the Digitalmars-d-learn mailing list