Thread overview
how to enable safeD ? dmd.conf ? dmd switch ?
Jun 08, 2021
someone
Jun 08, 2021
rikki cattermole
Jun 08, 2021
someone
Jun 08, 2021
Jack
Jun 08, 2021
someone
Jun 08, 2021
H. S. Teoh
Jun 08, 2021
someone
Jun 08, 2021
Andrea Fontana
Jun 08, 2021
someone
June 08, 2021

https://dlang.org/articles/safed.html
https://dlang.org/dmd-linux.html#switches
http://ddili.org/ders/d.en/functions_more.html

Neither man dmd nor man dmd.conf appear to have a related/switch setting.

Does it means safeD is achieved by placing @safe attributes all over the place ? Or is it achieved by setting some global switch elsewhere ? Am I missing something ?

June 08, 2021
On 08/06/2021 2:47 PM, someone wrote:
> https://dlang.org/articles/safed.html
> https://dlang.org/dmd-linux.html#switches
> http://ddili.org/ders/d.en/functions_more.html
> 
> Neither man dmd nor man dmd.conf appear to have a related/switch setting.
> 
> Does it means safeD is achieved by placing @safe attributes all over the place ? Or is it achieved by setting some global switch elsewhere ? Am I missing something ?

SafeD is an old name given to the attributes @safe @trusted @system.

There is no switch nor any special behavior now that it has long been added to mainline D.
June 08, 2021
On Tuesday, 8 June 2021 at 02:59:28 UTC, rikki cattermole wrote:

> SafeD is an old name given to the attributes @safe @trusted @system.

I have the Alexandrescu's book on hand so that explains it.

> There is no switch nor any special behavior now that it has long been added to mainline D.

So DMD now enforces it by default ? Will it complain if I make something out of the ordinary then ?
June 08, 2021
On Tuesday, 8 June 2021 at 03:32:31 UTC, someone wrote:
> On Tuesday, 8 June 2021 at 02:59:28 UTC, rikki cattermole wrote:
>
>> SafeD is an old name given to the attributes @safe @trusted @system.
>
> I have the Alexandrescu's book on hand so that explains it.
>
>> There is no switch nor any special behavior now that it has long been added to mainline D.
>
> So DMD now enforces it by default ? Will it complain if I make something out of the ordinary then ?

better read carefully how the attribute work, if you need aditional switches or anything,
for example, if you want to use return scope parameter and make the compiler give a compiler error if you set this parameter to a variable outside the function's scope, you have to use -dip25 -dip1000 switches
June 08, 2021
On Tuesday, 8 June 2021 at 03:54:47 UTC, Jack wrote:

> better read carefully how the attribute work

Good advice. I think I am going too fast. Thank you :)
June 07, 2021
On Tue, Jun 08, 2021 at 02:47:18AM +0000, someone via Digitalmars-d-learn wrote:
> https://dlang.org/articles/safed.html https://dlang.org/dmd-linux.html#switches http://ddili.org/ders/d.en/functions_more.html
> 
> Neither man dmd nor man dmd.conf appear to have a related/switch setting.
> 
> Does it means safeD is achieved by placing @safe attributes all over the place ? Or is it achieved by setting some global switch elsewhere ? Am I missing something ?

Annotate your functions with @safe.


T

-- 
Those who don't understand D are condemned to reinvent it, poorly. -- Daniel N
June 08, 2021
On Tuesday, 8 June 2021 at 04:24:38 UTC, H. S. Teoh wrote:

> Annotate your functions with @safe.

https://dlang.org/spec/function.html#function-safety
Best Practices: Mark as many functions @safe as practical.

ACK

June 08, 2021

On Tuesday, 8 June 2021 at 02:47:18 UTC, someone wrote:

>

https://dlang.org/articles/safed.html
https://dlang.org/dmd-linux.html#switches
http://ddili.org/ders/d.en/functions_more.html

Neither man dmd nor man dmd.conf appear to have a related/switch setting.

Does it means safeD is achieved by placing @safe attributes all over the place ? Or is it achieved by setting some global switch elsewhere ? Am I missing something ?

Just mark main() function with @safe and you're done.

June 08, 2021

On Tuesday, 8 June 2021 at 07:46:43 UTC, Andrea Fontana wrote:

>

Just mark main() function with @safe and you're done.

Fine, thanks :) !