News for hackers. Stuff that matters.
Re:To Save C, We Must Save ABI by FooBarWidget on Tuesday August 11, 2026 @06:27AM (#49255922)
> Not every high-level language gives you byte-level access to the representation of memory objects.

Any code that ventures anywhere near that territory is 99% Undefined Behavior. It's almost impossible to write proper C/C++ code that isn't UB while touching byte-level representations.

Re:To Save C, We Must Save ABI by uecker on Tuesday August 11, 2026 @06:29AM (#49255948)
This is certainly not true. Accessing bytes of objects is well-defined in C.
Re:To Save C, We Must Save ABI by FooBarWidget on Tuesday August 11, 2026 @08:35AM (#49257299)
Just look at this: https://blog.habets.se/2026/05/Everything-in-C-is-undefined-...

This is undefined behavior!

const int* magic_intp = (const int*)bytes;

Heck even something trivial like this is UB:

bool bar(char ch) { return isxdigit(ch); }

The only safe thing to do is memcpy, but that's super useless. As soon as you try to interpret or manipulate the byte-level data in any way, there are UB traps everywhere you go.

Re:To Save C, We Must Save ABI by uecker on Tuesday August 11, 2026 @08:59AM (#49257585)
Yes, using an arbitrary type that is different from the one of the object is UB. But any access of a representation byte using a character pointer is well defined, not just memcpy and I would also not call memcpy useless.