Skip to content

Instantly share code, notes, and snippets.

@pbackus
Created June 23, 2022 18:05
Show Gist options
  • Save pbackus/0e9c9d0c83cd7d3a46365c054129c554 to your computer and use it in GitHub Desktop.
Save pbackus/0e9c9d0c83cd7d3a46365c054129c554 to your computer and use it in GitHub Desktop.

Revisions

  1. pbackus created this gist Jun 23, 2022.
    14 changes: 14 additions & 0 deletions safety.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    issue |c |zig (release-safe)|rust (release)|Nim (release) |Nim (danger) |D (@safe)
    -----------------------------|----|------------------|--------------|--------------------|--------------------|---------
    out-of-bounds heap read/write|none|runtime |runtime |runtime |none |runtime
    null pointer dereference |none|runtime |runtime |runtime |none |runtime¹
    type confusion |none|runtime, partial |runtime |compile time |compile time |compile time
    integer overflow |none|runtime |runtime |runtime |none |wraps
    use after free |none|none |compile time |handled by gc |handled by gc |handled by gc or rc
    double free |none|none |compile time |handled by gc |handled by gc |handled by gc or rc
    invalid stack read/write |none|none |compile time |handled by gc |handled by gc |compile time
    uninitialized memory |none|none |compile time |memory always zeroed|memory always zeroed|memory always initialized
    data race |none|none |compile time |none |none |compile time (WIP)²

    1. D relies on the operating system to trap null dereferences.
    2. D's type system distinguishes between shared and thread-local data. Compile-time checks for unsynchronized access to shared data are partially implemented and currently considered experimental.