[Issue 14519] [Enh] foreach on strings should return replacementDchar rather than throwing

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 29 04:51:00 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14519

--- Comment #19 from Vladimir Panteleev <thecybershadow at gmail.com> ---
(In reply to Vladimir Panteleev from comment #16)
> (In reply to Walter Bright from comment #15)
> > It still allocates memory. But it's worth thinking about. Maybe assert()?
> 
> Sure.

Wait, now I'm not sure. For some reason I was thinking of assert(false) which
will always stop executions. But continuing upon encountering invalid UTF-8 in
release mode might result in bad outcomes as well.

The problem is that it's impossible to achieve 100% coverage and make sure that
all Unicode-handling code in your program also handles invalid UTF-8 in a good
way. Thus, an invalid UTF-8 handling problem might not be caught in testing but
might cause an unpleasant situation in release mode (depending on what happens
next after the assert is NOT thrown).

I don't feel too strongly about this though, I think programs that operate on
important data shouldn't run with -release anyway.

--


More information about the Digitalmars-d-bugs mailing list