Ali's slides from his C++Now talk
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Sun May 28 19:04:33 PDT 2017
On Monday, May 29, 2017 01:17:46 Corey Lubin via Digitalmars-d wrote:
> On Wednesday, 24 May 2017 at 00:05:54 UTC, Ali Çehreli wrote:
> > On 05/23/2017 04:31 PM, Joakim wrote:
> >> http://ddili.org/AliCehreli_CppNow_2017_Competitive_Advantage_with_D.no
> >> _pause.pdf
> "Functions defined as @safe and modules compiled with -safe
> cannot corrupt memory." (slide 90)
>
> Is there really a `-safe` command-line option?
>
> > Error: unrecognized switch '-safe'
>
> Maybe it's an old one that got pruned along the way..
I think that TDPL might talk about it, but if it ever was a thing, it's not
now and hasn't been for years. Largely, the safety stuff is all controlled
by the attributes in the code (@safe, @system, and @trusted), and compiler
switches don't affect that. The primary exception to that is the
-boundscheck flag, which lets you turn off bounds checking in @safe code
even though doing so is not @safe. Certainly, it's not the case that the
compiler doesn't care about memory safety until you use a compiler flag.
Under normal circumstances, anything marked with @safe can only call
functions that are @safe or @trusted and cannot do any operations which are
considered @system, whereas @system and @trusted functions can do whatever
they want with regards to @system operations, and the @safety of templated
functions is infered based on whether their bodies do anything that's
@system or not. Compiler flags don't enter into any of that.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list