Some questions about strings

Denis noreply at noserver.lan
Mon Jun 22 03:55:55 UTC 2020


On Monday, 22 June 2020 at 03:49:01 UTC, Adam D. Ruppe wrote:
> On Monday, 22 June 2020 at 03:43:58 UTC, Denis wrote:
>> My code reads a UTF-8 encoded file into a buffer and 
>> validates, byte by byte, the UTF-8 encoding along with some 
>> additional validation. If I simply return the UTF-8 encoded 
>> string, there won't be another decoding/encoding done -- 
>> correct?
>
> Yeah D doesn't do extra work when you are just passing stuff 
> around, only when you specifically ask for it by calling a 
> function or maybe doing foreach (depends on if you ask for char 
> or dchar in the foreach type)

Excellent. I'm trying to make this efficient, so I'm doing all of 
the validation together, without using any external functions 
(apart from the buffer reads).

Thanks!


More information about the Digitalmars-d-learn mailing list