D - Unsafe and doomed

logicchains jonathan.t.barnard at gmail.com
Fri Jan 3 19:31:45 PST 2014


On Saturday, 4 January 2014 at 03:16:37 UTC, Jesse Phillips wrote:
> Basically D provides safety, but it also provides means to do 
> unsafe things. I'm not familiar with Rust, but I wouldn't be 
> surprised if unsafe actions could also be taken.

You can still take unsafe actions, they just need to be wrapped 
in an 'unsafe' block. Any code that calls this block also needs 
to be marked as 'unsafe'. I recently wrote the exact same program 
in both D and Rust, and if you compare the two you'll find that 
almost the entire Rust program is enclosed in 'unsafe' blocks 
(note the Rust code is for a release from a couple of months ago, 
so the syntax is outdated).
https://github.com/logicchains/ParticleBench/blob/master/D.d
https://github.com/logicchains/ParticleBench/blob/master/R.rs


More information about the Digitalmars-d mailing list