Skip to content

Instantly share code, notes, and snippets.

@run-dlang
Created June 16, 2018 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save run-dlang/ba59bcca4464d875f95f975d13bebe88 to your computer and use it in GitHub Desktop.
Save run-dlang/ba59bcca4464d875f95f975d13bebe88 to your computer and use it in GitHub Desktop.
Code shared from run.dlang.io.
@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