[Issue 18580] std.conv.to!(ubyte[])(void[]) should work
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 8 18:10:19 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18580
ag0aep6g at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ag0aep6g at gmail.com
--- Comment #4 from ag0aep6g at gmail.com ---
(In reply to Jack Stouffer from comment #3)
> Is it unsafe though? In this specific case of void[] to ubyte[] (or vise
> versa) isn't it ok?
void[] to ubyte[] is unsafe, because anything converts to void[]:
----
void f(int*[] p)
{
void[] v = p; /* This is considered @safe. Don't even need a cast. */
ubyte[] b = cast(ubyte[]) v; /* Just as unsafe as `cast(ubyte[]) p`. */
b[0] = 123; /* Messing with pointers like this is not safe. */
}
----
--
More information about the Digitalmars-d-bugs
mailing list