Safe mode in D?
DDD
dcb854d0bfb1 at f98b7c56a69c.anonbox.net
Thu Oct 17 16:08:11 PDT 2013
On Thursday, 17 October 2013 at 23:03:52 UTC, Adam D. Ruppe wrote:
> On Thursday, 17 October 2013 at 22:56:04 UTC, DDD wrote:
>> Hi I heard that you can pass a command line argument to make D
>> safe.
>
> I don't think the command line argument is available anymore,
> instead it uses a function level annotation @safe
>
> So, on the function you want, you put it down and then that
> function can only do memory safe operations and only call other
> @safe, or manually verified @trusted functions.
>
> To get it site wide, you can put it on main:
>
> @safe void main() {
> // memory safe function
> }
>
>
> Note that not all standard library functions are properly
> marked @safe, so not all stdlib functions will be available.
> Notably, writeln() in std.stdio is not marked safe... you can
> work around it by making a @trusted writeln as described here
>
> http://stackoverflow.com/questions/19413340/escaping-safety-with-debug-statements
Is there a way to make everything safe by default and give me a
compile error if it isn't?
More information about the Digitalmars-d
mailing list