www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - how to enable safeD ? dmd.conf ? dmd switch ?

reply someone <someone somewhere.com> writes:
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 ?
Jun 07
next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
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.
Jun 07
parent reply someone <someone somewhere.com> writes:
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 ?
Jun 07
parent reply Jack <jckj33 gmail.com> writes:
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
Jun 07
parent someone <someone somewhere.com> writes:
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 :)
Jun 07
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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
Jun 07
parent someone <someone somewhere.com> writes:
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
Jun 07
prev sibling parent reply Andrea Fontana <nospam example.org> writes:
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.
Jun 08
parent someone <someone somewhere.com> writes:
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 :) !
Jun 08