On Wednesday, 2 September 2015 at 02:50:30 UTC, Jonathan M Davis
wrote:
is undefined behavior. So, don't do it.
I don't. Actually, I'm looking for opposite - to protect data,
like it is a class with two methods, returning void[] and
immutable(void)[] as memory buffer, which user of the class
supposed to cast to desired type. I naively assumed that void[]
to be cast to, say, int[]; and immutable(void)[] to
immutable(int)[] respectively. Unfortunately, D cast notices no
difference between these two types.
I seems a little bit too easy to to shoot yourself in the foot.
And still,
assert(&a == b);
assert(a != *b);
How these two lines would look in assembler? Defined behavior or
undefined behavior, I can't imagine that.