Created
June 16, 2018 20:24
-
-
Save run-dlang/ba59bcca4464d875f95f975d13bebe88 to your computer and use it in GitHub Desktop.
Code shared from run.dlang.io.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@safe: | |
import std.stdio; | |
class Foo | |
{ | |
void bar() | |
{ | |
*cast(int*)(0xdeadbeef) = 5; // Do something unsafe here | |
writeln("Foo:bar() - Me too!"); | |
} | |
} | |
void main() | |
{ | |
writeln("Main() - I'm safe!"); | |
(new Foo()).bar(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment