Submission timeline
2007–2026One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.
First comments on top threads
HN comment orderBecause there seems to be some confusion in this thread: - "Implementation-defined behavior" means that the C standard specifies the allowable behaviors that a C implementation must choose from, and the implementation must document its particular choice. - "Unspecified behavior" means that the C standard places no particular restrictions on the behavior, but a C implementation must pick a behavior and document its choice. - "Undefined behavior" means that C implementations are allowed to assume that the respective…
TFA is misunderstanding. As he cites from the C standard, “Undefined behavior gives the implementor license not to catch certain program errors that are difficult to diagnose.” Since it’s difficult (and even, in the general case of runtime conditions, impossible at compile time) to diagnose, the implementor (compiler writer) has two choices: (a) assume that the undefined behavior doesn’t occur, and implement optimizations under that assumption, or (b) nevertheless implement a defined behavior for it, which in many…
Unfortunately you have to choose what you want your C compiler to be. It can be little more than a macro assembler that preserves "the obvious" behavior of undefined constructs on the target platform. Most compilers will do this by default (-O0). Or you can opt into using an optimizing compiler (-O2). But when optimization passes ignore the possibility of undefined behavior with unpredictable results (as explicitly allowed by the standard), you get, well, unpredictable results. Nowadays compilers even offer…
The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.
- Breakout years
- 2
- Total points
- 239
- Total comments
- 562
100+ points or 50+ comments
reference only — not used in Hall rules or ranking
reference only — not used in Hall rules or ranking
Every submission
| Date | Title as submitted | By | Points | Comments |
|---|---|---|---|---|
| 2021-05-19 | Undefined behavior in C is a misinterpretation of the Standard | vyodaiken | 2 | 0 |
| 2021-05-20 | Undefined behavior in C is a reading error | r4um | 9 | 4 |
| 2021-05-20 | Undefined behavior in C is a reading errorFirst breakout · Best thread | zdw | 203 | 491 |
| 2024-09-02 | Undefined behavior in C is a reading error (2021)Latest 20+ point return | nequo | 25 | 67 |
