@regehr I'm reading, reading, waiting for something new, and the new “idea” is the implication that using an LLM makes using C safe. Or safer. I'm not sure. In any case it's irresponsible to not use one, so using one is good, or less bad, surely.

Man,

  • wrong tool for the job
  • still the wrong language to be using in 2026 for 98% of what it is used for, even with an LLM
  • are you writing software piloting any bridges that I can avoid standing on?
@void_friend @regehr Ugh, a list of things we all already know about C, which is fine because it's a neat list, but then "LLMs are better than us at this". Delete tab.
@jripley @void_friend yes it's very 2026 to write a 2012 post with 10% of LLMs at the end
@regehr @jripley @void_friend It's not undefined behavior—it's strategic optionality for maximizing performance.
@regehr Dr Manhattan is the undefined behaviour, especially when he travels back through time
@regehr phooey. I'll stick to C89 then, before they went overboard with the abstract machine. We don't have CPUs with 1s complement math any more, nor with 9 bit bytes. We don't have to worry about invisible bits in 36bit integers. The compiler's job is to turn C code into assembly code. If it's gratuitously setting tags into the low bits of pointers, that the programmer didn't ask for, it's a broken compiler.

@regehr if it's eliding `if (foo == NULL)` checks that the programmer asked for, the compiler is broken. If it's making any aliasing assumptions, so that it can omit memory loads that the programmer asked for, it's broken.

What use is a standard that allows a compiler to ignore the source code it's given?

Does the spec assume a flat linear address space? Does it prohibit Near and Far pointers, that riddled x86 code bases, with multiple memory models?

@regehr The concept of definedness isn't even sensible. Saying the compiler is free to do anything it wants for undefined behavior is bogus. It can't take a division by zero sequence and decide to emit a completely unrelated code sequence instead. The result of that arithmetic is undefined, but it still has to issue the instruction. It may not know at compile time that the divisor will be zero, so it has to just emit the code as requested.
@regehr Leave things implementation-defined. Let the x86s have their segmented memory models. Let the source code be machine and implementation specific. So what? We already know how to #ifdef for porting between different OSs and platforms, and the need for adaptation to different platforms will never go away. So wishing for perfect source portability on an ideal abstract machine is futile anyway. It's an invalid justification for these definedness rules.

@hyc @regehr That's not what it means though. Undefined beams that the compiler can assume it will never happen. That's a very different thing.

Now, that doesn't mean that I agree that the way C is specified is good. It's very much the opposite. But the concept still makes sense, even if it's a bad concept.

@loke @regehr Undefined meant ... https://feross.org/gcc-ownage/

I was a gcc maintainer back then, I used to use this to start hack all the time...

GCC Easter Egg: C++ Undefined Defined Behavior » Feross.org

Feross Aboukhadijeh is a computer security researcher, teacher, web developer, designer, long distance runner, gamer, music lover, and builder of websites that (sometimes) go viral.

@hyc @regehr No, in fact the standard goes out of its way to avoid accidentally saying the address space is flat.
@regehr It is NaN and we are blogging about [object Object]