Debug help - Programming in D - extending tail slice terminates sharing unexpectedly. Page 69, 70
Brother Bill
brotherbill at mail.com
Wed Oct 22 02:04:14 UTC 2025
On Tuesday, 21 October 2025 at 23:16:48 UTC, monkyyy wrote:
> On Tuesday, 21 October 2025 at 10:28:52 UTC, Brother Bill wrote:
>> On Tuesday, 21 October 2025 at 02:42:07 UTC, monkyyy wrote:
>>> On Tuesday, 21 October 2025 at 02:08:41 UTC, Brother Bill
>>> wrote:
>>>>
>>>> If there are valid cases where breaking sharing is
>>>> intentional and useful, kindly share some of those scenarios.
>>>
>>> appending a null to a string for toStringz
>>
>> Do you mean appending an ASCII NUL character 0x00 to a string
>> to make it C language friendly?
>
> yes
I'm a bit obsessive-compulsive of the difference between null
(pointer) and NUL, the first ASCII character.
As far as your example, escaping to the heap is one approach.
Another is to make a copy of the slice, then append NUL character.
More information about the Digitalmars-d-learn
mailing list