The C programming language is designed to let programmers work at both low and high levels. In particular, for applications like operating system development, cryptography, numerical methods, and network processing, programmers can go back and forth between treating data as
Three modest proposals for the C standard WG14
Note: these were sent to WG14 as official proposals. See also a longer paper, something on alias and Torvalds remarks and Regehr’s paper. 6.12 Proposal to clarify undefined behavior range for implementations [N 2278] 6.13 Proposal to make aliasing consistent [N
Vector optimization with C aliasing
One of the common defenses of the abuse of “undefined behavior” by C compilers, and the stupid aliasing rules in the standard is that those things are necessary for optimizations, like using vector operations. Here’s an example of where gcc
Torvalds on aliasing
See also PLOS article, pointer alias in C and remarks on the purpose of C. From: LKML From Linus Torvalds <> Date Tue, 5 Jun 2018 10:30:21 -0700 Subject Re: [GIT PULL] Device properties framework update for v4.18-rc1 On Mon, Jun
Pointer alias analysis in C
Perhaps there is some reason to provide a mechanism for asserting, in a particular patch of code, that the compiler is free to make optimistic assumptions about the kinds of aliasing that can occur. I don’t know any acceptable way of
Depressing and faintly terrifying days for the C standard
C STANDARD UNDEFINED BEHAVIOR VERSUS WITTGENSTEIN 1. DEPRESSING AND FAINTLY TERRIFYING Chris Lattner, the architect of the Clang/LLVM C compiler explained the effects of the C standard’s “undefined behavior (UB): UB is an inseperable part of C programming, […] this
More UB madness from LLVM/Clang
Via @johnregehr this further tale of compiler “optimizations” that break correct C code without even a warning by deleting a necessary null pointer check. In this example, Bar contains a stack of Foos. Sometimes the Foo stack is empty, so
Types considered harmful II
Originally Nov 30, 2017. (revised 2021,2023) Russell introduced what is often viewed as his most original contribution to mathematical logic: his theory of types—which in essence tries to distinguish between sets, sets of sets, etc. by considering them to be
Bad ideas in type theory
Types as sets and subtypes as subsets. This may be due to confusing usage in mathematical practice where, for example, we often see references to integers as a subset of reals. But in mathematical usage, people generally understand that while
C compiler developers are hostile to C programming
From the LLVM developer mailing list this remarkable exchange in which Chris Lattner of LLVM says that the compiler use of undefined behavior (UB) is so “crappy” that the only solution is to abandon C programming (my bold). On Jul