dmd foreach loops throw exceptions on invalid UTF sequences, use replacementDchar instead

max haughton maxhaton at gmail.com
Sat Nov 6 04:25:31 UTC 2021


On Friday, 5 November 2021 at 23:01:24 UTC, Ali Çehreli wrote:
> On 11/5/21 5:38 AM, max haughton wrote:
>
> > I have never ever seen someone use a static array by mistake
>
> Related, although safe, vector::at is almost never used because 
> the more convenient (but unsafe) vector.operator[] exists:
>
>   v[42]     // What Ali saw in the wild
>   v.at(42)  // What Ali did not see as much in the wild
>
> Ali

Although I understand what Walter is trying to say, he picked a 
poor example, this one does actually make sense. Although in the 
world of sanitizers and such it is not a hard thing to catch, 
bounds checking by default is a win.


More information about the Digitalmars-d mailing list