KennyTM~ Wrote:

> It is already throwing an exception called 
> core.exception.UnicodeException. This even provides you the index where 
> decoding failed.
> 
> (However Phobos is not using it, AFAIK.)
> 
> -----------
> import core.exception, std.stdio, std.conv;
> 
> void main() {
>      char[] s = [0x0f, 0x12,0x34,0x56,0x78,0x9a,0xbc];
>      try {
>          foreach (dchar d; s){}
>      } catch (UnicodeException e) {
>          writefln("error at index %s (%x)", e.idx, to!ubyte(s[e.idx]));
>          // error at index 5 (9a)
>      }
> }
> -----------

foreach does not use the range interface provided by std.array (that I know 
of). So there should be a bug reported on the current behavior of Access 
Violation.

Reply via email to