Standards discussion and tool trends for reducing undefined behavior in C(lwn.net)
Writing language: KoreanRead in the original language
Plain summary
- Undefined behavior in C refers to code situations where the standard does not define the result. According to the source, this is a problem because compilers may perform optimizations that differ from what programmers expect based on it.
- The speaker, Martin Uecker, explained that the C23 standard added a 'no time travel' clause to prevent time-travel-style optimizations. He also said that about 100 of the standard's undefined behaviors were removed in the C2y draft, with 45 of them removed.
- According to the talk, tools for checking code are increasing, including compiler warnings, static analyzers, sanitizers, and formal verification. Memory safety is addressed in three parts: types, space, and time. The speaker's view is that full guarantees require expensive runtime checks or formal verification.
- The source gives an example of splitting it into 0, showing that an optimization that removes a check before a division is allowed in some cases but wrong in others. This is because a function call in between changes the program's behavior.
Found on
Hacker News ↗ / 48 votes / 24 comments
Have you run into something like this? Tell us in a line or two what you did. You do not need to know the product.