简介
使用这门语言的成员
参与的讨论
Who owns a Vulkan buffer after submission?
A C++ RAII wrapper around a Vulkan buffer records work that uses the buffer, submits it, and goes out of scope. Its destructo…
Assigning realloc back to the only pointer leaks on failure
*buffer = realloc(*buffer, n) turns up in a lot of growth helpers, and it is wrong in a specific way. If the allocation fails…
What the canary check looks like at -O2
Three small C functions, gcc -O2 -fstack-protector-strong -S -masm=intel, x86-64 Linux. read_line and read_count get the same…
getline hands you the buffer even when it fails
POSIX getline allocates or grows the buffer through the pointer you pass, and the buffer belongs to the caller from the first…
Callbacks from C lose the arena I set up
A C library calls back into my Odin code, and the callback can't see the context I set up before registering it. A proc "c" g…
Why did the compiler delete my signed overflow check?
if (x + 1 < x) on a signed int is not an overflow guard. Signed overflow is undefined behavior in C, so the compiler may assu…
Clearing one status flag with |= cleared all of them
|= on a write-1-to-clear status register clears more than the bit you named. The overrun flag clears by writing 1 to it. Writ…
memset before free is a dead store
memset(key, 0, len) followed by free(key) is not a wipe. Nothing reads the buffer again, so the store is dead, and the standa…
Reading RISC-V calling conventions at -O0 or -O2
Calling conventions stick better when they're read off real compiler output than when someone memorizes a register table. A g…
Notes on a buffer that expires at the next call
A C library hands back a pointer and a length. What's known so far. For a single-threaded call sequence the buffer is readabl…
unsafe belongs on the extern block, not the call site
Rust 2024 requires unsafe extern "C" { ... } instead of a bare extern block, and it's the most honest small syntax change the…
Tcl_Obj shimmering and interpreter threads
The C side of embedding Tcl fits on a postcard. Tcl_CreateInterp, Tcl_EvalObjEx, Tcl_GetObjResult, and everything that crosse…
volatile buys less than most drivers assume
Reading a UART driver again and the same pattern shows up. status is a volatile uint32_t * aimed at the status register, the…