Reddit: SafeD - The Safe Subset of D

Chris Miller lordSaurontheGreat at gmail.com
Tue Mar 25 16:49:53 PDT 2008


Chris Miller Wrote:

> On Sat, 22 Mar 2008 21:47:59 -0700
> Walter Bright <newshound1 at digitalmars.com> wrote:
> 
> > 
> > http://reddit.com/r/programming/info/6d210/comments/
> 
> I think this calls for a compiler switch that forces bounds checking on, whether or not debug or release mode. You don't want to be shipping debug code.
> 
> Also, a pragma or similar would be helpful; if it could enable bounds-checking from that point until the end of the scope, you could completely rely on bounds checks in your code, like you can do in other modern languages.
> 
> Finally, would SafeD have to disallow destructors? If you're accessing garbage collected memory in a destructor, you're asking for trouble. It's not always as simple as directly disallowing access these fields. Calling functions can indirectly cause the memory to be accessed. However, if you're not accessing GC memory in a destructor, you're probably using some lower-level functions, which are generally untrustworthy.

I thought the garbage collector only freed memory after the destructor had been run.

DMD 1.00 spec document, page 104 says "The garbage collector calls the destructor when the object is deleted."

Did this change?  I haven't checked for an update to my copy of the spec document in some time.

-- the "other" Chris Miller


More information about the Digitalmars-d-announce mailing list