Challenge: write a really really small front() for UTF8
Vladimir Panteleev
vladimir at thecybershadow.net
Sun Mar 23 22:16:38 PDT 2014
On Sunday, 23 March 2014 at 22:58:53 UTC, Andrei Alexandrescu
wrote:
> On 3/23/14, 3:10 PM, Dmitry Olshansky wrote:
>> 24-Mar-2014 01:34, Andrei Alexandrescu пишет:
>>> On 3/23/14, 2:29 PM, Dmitry Olshansky wrote:
>>>> 24-Mar-2014 01:22, Andrei Alexandrescu пишет:
>>>>> Here's a baseline: http://goo.gl/91vIGc. Destroy!
>>>>>
>>>> Assertions to check encoding?!
>>>> I thought it would detect broken encoding and do a
>>>> substitution at
>>>> least.
>>>
>>> That implementation does zero effort to optimize checks
>>> themselves, and
>>> indeed puts them in asserts. I think there's value in having
>>> such a
>>> primitive down below.
>>
>> Just how much you are willing to assert? You don't even check
>> length.
>
> Array bounds checking takes care of that.
Since strings are often user input, if there is chance that bad
input can cause undefined behavior, then the checks must be done
unconditionally.
More information about the Digitalmars-d
mailing list