What is the simplest way of doing @nogc string concatenation?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 4 08:16:35 PDT 2016


On Friday, 4 November 2016 at 14:56:46 UTC, Guillaume Piolat 
wrote:
> On Friday, 4 November 2016 at 14:55:27 UTC, Guillaume Piolat 
> wrote:
>> On Thursday, 3 November 2016 at 18:54:14 UTC, Gary Willoughby 
>> wrote:
>>> What is the simplest way of doing @nogc string concatenation?
>>
>> I use sprintf + zero-terminated strings (or a RAII struct to 
>> convert slices to ZT strings).
>
> Example with the the useful "%.s" format:
> https://github.com/AuburnSounds/dplug/blob/1037d8a99a6ac730f4d6cc56806dddc83bce07ed/client/dplug/client/client.d#L442
>
> That way you don't have to add the terminal '\0'

but be cautious: this will still stop on zero byte. most of the 
time it doesn't matter, but...


More information about the Digitalmars-d-learn mailing list