- C++20 (g++ & clang++)
- Circle (safe-cpp)
- D (extern(C++))
- Rust (legacy)
url: https://godbolt.org/z/P9EMxWveK
based on: llvm/llvm-project#62765
url: https://godbolt.org/z/P9EMxWveK
based on: llvm/llvm-project#62765
// Works in betterC mode (tested on: ldc2 & opend-ldc2) | |
module arena; | |
struct Arena | |
{ | |
void* start; | |
size_t used; | |
size_t capacity; | |
static scope Arena* create(size_t capacity) |
const std = @import("std"); | |
const math = std.math; | |
const assert = std.debug.assert; | |
const testing = std.testing; | |
pub const Policy = struct { | |
pub const SignPolicy = enum { | |
return_sign, | |
ignore_sign, | |
}; |
issue | c | zig (release-safe) | rust (release) | Nim (release) | Nim (danger) | D (@safe) | Swift | modern C++ |
---|---|---|---|---|---|---|---|---|
out-of-bounds heap read/write | none | runtime | runtime | runtime | none | runtime | runtime | none³ |
null pointer dereference | none | runtime | runtime | runtime | none | runtime¹ | runtime | none⁴ |
type confusion | none | runtime, partial | runtime | compile time | compile time | compile time | compile time | partial⁵ |
integer overflow | none | runtime | runtime | runtime | none | wraps | runtime (checked) | undefined behavior |
use after free | none | none |
//! Zig v0.13.0 or master | |
//! Recommended `-Doptimize=ReleaseSmall` or `-Doptimize=ReleaseFast` (disabling sanitizer) | |
const std = @import("std"); | |
pub fn build(b: *std.Build) void { | |
const target = b.standardTargetOptions(.{}); | |
const optimize = b.standardOptimizeOption(.{}); | |
// -Duse_tb | |
const use_tb = b.option(bool, "use_tb", "Enable the tild backend") orelse false; |
//! Based on: https://github.com/denizzzka/ldc-external_druntime_backend/blob/external_druntime_backend_support/runtime/druntime/meson.build | |
const std = @import("std"); | |
const abs = @import("abs"); | |
const builtin = @import("builtin"); | |
pub fn build(b: *std.Build) !void { | |
// ldc2/ldmd2 not have mingw-support | |
const target = b.standardTargetOptions(.{ | |
.default_target = if (builtin.os.tag == .windows) |
Original post: kubo39/gist 🇯🇵
A cache algorithm called [SIEVE][sieve-website] was announced in 2023. It claims to be simpler than LRU, and indeed it is a fairly simple algorithm, but it is said to perform as well as existing superior cache algorithms such as S3-FIFO and TinyLFU.
updated: https://godbolt.org/z/fqT37xGPM - add Dlang and fix c++ initialize_list
Not installed .NET
# D betterC
Benchmark 1 (121 runs): ./structmem_rs
Zig toolchain [forked] uses LLVM codegen for mos target.
Current version: