Re: wstring comparison is failing

2019-09-24 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 24 September 2019 at 21:40:47 UTC, Brett wrote: The only issue is that buggy dynamic code can result if someone compares the two and it will fail silently. But, you don't know if the static array actually contains a null-terminated string (in which case the comparison is a bug) or

Re: wstring comparison is failing

2019-09-24 Thread Brett via Digitalmars-d-learn
On Tuesday, 24 September 2019 at 00:29:05 UTC, Vladimir Panteleev wrote: On Monday, 23 September 2019 at 23:22:14 UTC, Brett wrote: 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?

Re: wstring comparison is failing

2019-09-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 23 September 2019 at 23:22:14 UTC, Brett wrote: 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

Re: wstring comparison is failing

2019-09-23 Thread Jonathan M Davis via Digitalmars-d-learn
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 +, Brett via > > > > Digitalmars-d-learn wrote: > >> The only thing is that szExeFile is a static

Re: wstring comparison is failing

2019-09-23 Thread Brett via Digitalmars-d-learn
On Monday, 23 September 2019 at 20:45:00 UTC, destructionator wrote: On Mon, Sep 23, 2019 at 08:38:03PM +, 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,

Re: wstring comparison is failing

2019-09-23 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 23 September 2019 at 20:38:03 UTC, Brett wrote: cast(wstring)entry.szExeFile == Name to!wstring(entry.szExeFile) == Name These all fail. The strings are clearly the same. I can compare char by char and it works. latest D 2.088. The only thing is that szExeFile is a static wchar

Re: wstring comparison is failing

2019-09-23 Thread Adam D. Ruppe via Digitalmars-d-learn
On Mon, Sep 23, 2019 at 08:38:03PM +, 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...

wstring comparison is failing

2019-09-23 Thread Brett via Digitalmars-d-learn
cast(wstring)entry.szExeFile == Name to!wstring(entry.szExeFile) == Name These all fail. The strings are clearly the same. I can compare char by char and it works. latest D 2.088. The only thing is that szExeFile is a static wchar array... which shouldn't effect the comparison.