what exactly is string length?

mw mingwu at gmail.com
Fri Apr 2 15:01:07 UTC 2021


On Friday, 2 April 2021 at 05:02:52 UTC, mw wrote:
> On Friday, 2 April 2021 at 04:54:07 UTC, Computermatronic wrote:
>> On Friday, 2 April 2021 at 04:49:22 UTC, mw wrote:
>>> So you mean inside the writeln() call, the 0s are skipped?
>>>
>>> Well, if I use `string t` as filename, it will try to looking 
>>> for a file called:
>>>
>>> "head-abc\0\0\0-tail" instead of just "head-abc-tail" ?
>>>
>>> or it's platform dependent?
>>
>> I would imagine that it's platform dependant, but given most 
>> platforms adhere to the C ABI, and C string are null 
>> terminated, you'd end up looking for a file called "head-abc".
>
> Ahh, I got what I see (from writeln) is not what get string 
> here ;-)
>

BTW, shall I log a writeln() improvement bug ?

It's really confusing, e.g as debug print or logs.

Output something like:

"head-abc\0\0\0-tail"

"head-abc...-tail"
"head-abc???-tail"

is more clear.








More information about the Digitalmars-d-learn mailing list