[Issue 12980] Undefined behavior: Assignment of static string to dynamic string

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jun 24 05:13:56 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12980

--- Comment #4 from bearophile_hugs at eml.cc ---
(In reply to Yuriy from comment #3)

> Ah, ok. Initially the bug was found when using std.digest.toHexString
> instead of getSomeString in my example.

Yes toHexString returns an array by value. This is not common in D APIs. As
more and more D code returns small arrays by value (to allow them to be @nogc
and increase performance), this kind of problems and bugs will become
sufficiently common that D programmers will be more aware of them and so they
will avoid them... :-)

--


More information about the Digitalmars-d-bugs mailing list