About undefined behaviour...
About undefined behaviour...
Posted Aug 16, 2012 16:45 UTC (Thu) by juhl (guest, #33245)Parent article: Signed overflow optimization hazards in the kernel
For people interrested in (or concerned about) undefined behaviour, the problems it can cause and the optimizations it enables etc, I can greatly recommend reading the following articles:
What Every C Programmer Should Know About Undefined Behavior #1/3
What Every C Programmer Should Know About Undefined Behavior #2/3
What Every C Programmer Should Know About Undefined Behavior #3/3
A Guide to Undefined Behavior in C and C++, Part 1
A Guide to Undefined Behavior in C and C++, Part 2
A Guide to Undefined Behavior in C and C++, Part 3
Sequence Points and Expression Evaluation in C++
Posted Aug 16, 2012 22:50 UTC (Thu)
by hummassa (subscriber, #307)
[Link]
Posted Aug 16, 2012 22:52 UTC (Thu)
by PaulMcKenney (✭ supporter ✭, #9624)
[Link]
Posted Aug 23, 2012 16:03 UTC (Thu)
by pwood (guest, #86373)
[Link]
About undefined behaviour...
About undefined behaviour...
John Regehr's blog posts on undefined behaviour are always worth reading (his research group developed the IOC patch to clang that a couple of people have linked to above.) In the context of integer behaviour in C he has a quiz here which is worth a look.
I'm not sure that you ever want to rely on undefined behaviour as suggested in the article as it means that the execution of your program is undefined and can change at the compiler's will. That is very different from relying on implementation defined behaviour.
About undefined behaviour...