Comment

Comment by Joker_vD

Also, C23 (and C2y) is moving ever closer to actually having defined semantics. As in, "just because one branch of your code, for this particular input, has read a value out of an array's bounds, your whole program's execution doesn't suddenly rewinds back to the start (with I/O included) and NOPs/loops infinitely/executes random bytes after main()".

Also, I'm personally still waiting for a "shift left" operator having cleaner wording in the standard:

    If E1 has an unsigned type, the value of the result is E1 × 2**E2, wrapped
    around. If E1 has a signed type and nonnegative value, and E1 × 2**E2 is
    representable in the result type, then that is the resulting value; otherwise,
    the behavior is undefined.
What does "otherwise" means here? It can't mean "if E1 has an unsigned type, or negative value, or E1 × 2**E2 is unrepresentable, then the behavior is undefined" because the part "if E1 has an unsigned type" has already been covered by the previous clause. Does it mean "If E1 has negative value, or E1 × 2**E2 is unrepresentable, then the behavior is undefined"? Because that's a ridiculous ordinance: (-1) << 1 is UB?!
parent Joker_vD 17 days ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton