Michel Fortin wrote:
There is a very good reason to disallow manipulating the bit pattern in safe D however: memory safety. If you can dereference a pointer made from an arbitrary bit pattern, you may have an exploitable flaw similar to a buffer overrun. Dereferencing an arbitrary value is definitely *not* memory-safe and should *not* be allowed in safe D.

And it is not allowed in safe functions.

So you shouldn't be able to cast a value to a pointer. The reverse, casting a pointer to a value, makes sense in my opinion: you may want to print the pointer value in a debug output of some sort. There's nothing unsafe with that so it should be allowed.

These are allowed in safe functions.

Reply via email to