DIP76: Autodecode Should Not Throw

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 7 00:50:38 PDT 2015


On Tuesday, 7 April 2015 at 07:42:02 UTC, w0rp wrote:
> Maybe autodecoding could throw an Error (No 'new' allowed) when 
> debug mode is on, and use replacement characters in release 
> mode. I haven't thought it through, but that's an idea.

No no no, terrible idea. This means your program will pass your 
test suite in debug mode (which, of course, is never going to 
test behavior with bad UTF in all the relevant places), but 
silently corrupt real-world data in release mode. Errors and 
asserts are for logic errors, not for validating user input!


More information about the Digitalmars-d mailing list