
Unspecified vs Implementation-Defined vs Undefined Behaviour
Unspecified, implementation-defined and undefined behavior are three different promises in C. Learn what each guarantees and how to tell them apart.
Tag
255 posts

Unspecified, implementation-defined and undefined behavior are three different promises in C. Learn what each guarantees and how to tell them apart.

Cancel async work in Tokio by dropping futures, racing them with select!, and signalling many tasks at once with tokio-util's CancellationToken.

Build a versioned shared library with -Wl,-soname, upgrade it in place so programs pick up a patch, and ship an ABI break under a new soname.

Cut strace 6.8 output to the system calls that matter using -e trace= with call names, class sets like %file and %network, negation, regexes and status=failed.

Build and run the STREAM benchmark with gcc and OpenMP to measure sustainable memory bandwidth, size the arrays so they miss cache, and read the four kernels.

Label phases of a CUDA program with NVTX push and pop ranges, the C++ scoped_range helper and domains, so Nsight Systems shows your names beside the kernels.

A cheat sheet of 15 kinds of undefined behavior in C, each with an example, the sanitizer message, the safe fix and when it is not a problem.

A shared library has three names: the linker name used at build time, the soname recorded in binaries and the real name of the file. See how they fit together.

Build container isolation by hand: Linux namespaces for what a process sees, cgroups v2 for what it may use, with C code for clone and pivot_root.

A working method for Linux 6.12 kernel bugs: debug builds, reading oopses, runtime checkers, tracing, gdb in QEMU, hangs, and capturing crashes with kdump.

Run ncu on one kernel, pick sections like SpeedOfLight and WarpStateStats, read the results and follow the rules for turning counters into a specific fix.

Bundle a Linux program with its libraries in one folder that runs from any path, using an $ORIGIN runpath, ldd to collect dependencies and a launcher check.