List of Phobos functions that allocate memory?

Dominikus Dittes Scherkl Dominikus.Scherkl at continental-corporation.com
Sat Feb 8 13:53:34 PST 2014


On Saturday, 8 February 2014 at 18:44:38 UTC, Brad Anderson wrote:
> I wonder if it'd be too reckless to just make decode for string
> nothrow (we want this function to be as fast as possible) and
Yes. It shouldn't throw. Never.

> just require that string, by definition, must be valid unicode.
Why?
Replacement of broken code is defined by unicode - we should use 
it.
Noone prevents you to call isValidUnicode beforehand and handle 
that sepearately if it returns "false" (I would recomment that 
only if security is relevant e.g. if you chack a signature or 
something like that) or search for 0xFFFD in the result string 
afterwards and throw if you find some (but this is generally no 
good idea because the replacement characters may have been there 
even before and were intended).
As default relplacing broken characters is very good. And fast.



More information about the Digitalmars-d mailing list