List of Phobos functions that allocate memory?

Brad Anderson eco at gnuk.net
Sat Feb 8 10:44:37 PST 2014


On Saturday, 8 February 2014 at 05:04:35 UTC, Jonathan M Davis
wrote:
> I think that that would call for us to have 3 related but 
> distinct functions:
>
> 1. decode, which throws on invalid Unicode. We already have 
> this.

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
just require that string, by definition, must be valid unicode.
to!string and company could validate strings as they come in from
foreign sources. This way invalid unicode is caught early and
decode gets a speedup.

char[] is different because the mutability means it could be made
invalid at any time so we can't rely on it staying valid after
it's been checked but once a string has been confirmed valid
there is no reason to check it for validity ever again.


More information about the Digitalmars-d mailing list