On Monday, September 23, 2019 5:22:14 PM MDT Brett via Digitalmars-d-learn wrote: > On Monday, 23 September 2019 at 20:45:00 UTC, destructionator > > wrote: > > On Mon, Sep 23, 2019 at 08:38:03PM +0000, Brett via > > > > Digitalmars-d-learn wrote: > >> The only thing is that szExeFile is a static > >> wchar array... which shouldn't effect the comparison. > > > > are you sure about that? > > > > with a static size, the lengths of the two sides won't match... > > I guess you are probably right... I was thinking that it would > compare up to a null terminator. Seems kinda buggy... maybe the > compiler needs to give a warning? After all, compared a fixed > size array with a dynamic array then will almost always fail > since it is unlikely the sizes will match... > > ...rather than failing silently.
D does virtually nothing with null terminators. String literals have them one index past their end so that you can pass them to C functions without D code actually seeing the null terminator, but otherwise, you have to add the null terminator when passing to C code (e.g. with toStringz or toUTFz), and you have to strip it off when getting a string from C code (e.g. with fromStringz). Other than functions specifically designed to convert to and from C strings, D code is going to treat null terminators just like any other character, because D strings are not null-terminated. - Jonathan M Davis