hack on @safe functions

Dicebot public at dicebot.lv
Mon Feb 3 04:50:22 PST 2014


On Monday, 3 February 2014 at 12:41:30 UTC, Pavel wrote:
> struct T {
> 	ubyte[0x12FDB5/*address of local x in main + 1*/] x;
> }
>
> @safe void test() {
> 	T* t = null;
> 	t.x[$-1] = 99;
> }
>
> void main() {
> 	ubyte x = 0;
> 	writeln("\n", &x, ' ', x);
> 	test();
> 	writeln("\n", x);
> }

This has been recently mentioned if thread about null dereference 
"safety" :)


More information about the Digitalmars-d mailing list