std.utf: use throw UTFException instead of assert(0) in stride, etc

Timothee Cour thelastmammoth at gmail.com
Tue Dec 10 17:05:34 PST 2013


well then it's a bug:

https://d.puremagic.com/issues/show_bug.cgi?id=11721

this is the 3rd regression I'm posting today!



On Tue, Dec 10, 2013 at 4:45 PM, Jonathan M Davis <jmdavisProg at gmx.com>wrote:

> On Tuesday, December 10, 2013 15:52:06 Timothee Cour wrote:
> > in std.utf shouldn't we throw UTFException instead of assert(0) in
> stride,
> > etc ?
>
> std.utf only uses assert(0) when that code should be unreachable. It's
> used to
> catch bugs in the implementation, not in a function's input. If anything in
> std.utf ever hits an assert(0), it's a bug. A UTFException _is_ thrown
> when a
> std.utf function encounters invalid Unicode. It's certainly possible that
> there's a bug involving assert(0) in std.utf, but there shouldn't be any
> case
> in all of Phobos where an assert(0) would actually be hit.
>
> - Jonathan M Davis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131210/7bc12db2/attachment.html>


More information about the Digitalmars-d mailing list