Does the compiler check for safe?

cym13 via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sun Jun 28 00:57:48 PDT 2015


On Sunday, 28 June 2015 at 07:49:41 UTC, Charles Hixson wrote:
> I took some code that was annotated safe, and modified it to 
> use a buffer internal to the class, and an offset counter.  
> Some of the routines adjusted the counter.  I forgot to remove 
> the  "safe" annotation.
>
> It compiled without error.  So...
> 1) The compiler didn't check for safety
> 2) It counts as safe if you only modify local-to-the-class 
> variables (and I misunderstood).
> or
> 3) This error is only detected on execution
>
> But which?
>
> (I'm still writing the code, so I can't yet try to execute it, 
> and I took off the safe annotation because after I read the 
> definition in TDPL it seemed a mistaken annotation.  But 
> perhaps I misunderstand.)

Please don't post in Announce for questions, Learn would be a 
better place.

For your problem, reading the list 
http://dlang.org/function.html#safe-functions I'm not sure what 
is unsafe in what you do.


More information about the Digitalmars-d-announce mailing list