[Issue 12417] `toStringz` is fundamentally broken
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Mar 24 08:47:12 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=12417
--- Comment #4 from Denis Shelomovskij <verylonglogin.reg at gmail.com> ---
(In reply to John Colvin from comment #3)
> You mean something like this?
Yes, this is an example of what may go wrong. But in a general case we don't
even know what calling convention (e.i. ABI) so the reference can be easily
lost.
Also now most `toStringz`/`toUTF16z`/`toUTFz` usages in Phobos are replaced
with `tempCString*` ones [1] so this doesn't affect much Phobos itself.
The problem is `toStringz` and friends aren't properly documented as dangerous
(and also inefficient by the way) and `tempCString*` replacement isn't public
(addition of new public features to Phobos looks too complicated for me).
[1] https://github.com/D-Programming-Language/phobos/pull/2332
--
More information about the Digitalmars-d-bugs
mailing list