u/foonathanin r/programming • Recommends
On “On finding the average of two unsigned integers without overflow”
#std::midpoint#c++20#undefinedbehavior
189K subscribers • 123 videos on Hallway • Conference channel
Intermediate. Assumes working knowledge.
26K views7 years ago2 recommendations
Programming languagesSystems programmingC++Performance and optimization
Marshall Clow explores the surprisingly subtle challenges of computing the midpoint between two values in C++ without triggering undefined behavior.
CppCon.org — Discussion & Comments: reddit.com/r/cpp/ — Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2019 — The standards committee adopted "P0811: Well-behaved interpolation for numbers and pointers" for C++20. It includes a new library call `std::midpoint`. The paper says "The simple problem of computing a value between two other values is surprisingly subtle in general." In this talk, I will explore this simple call, provide a history of the development in libc++, and show some of the pitfalls. Undefined behavior will rear its ugly head, along with numeric representations, and the arcane C promotion rules. Along the way, we'll talk about testing, and why writing extensive tests helps everyone. — Marshall Clow C++ Alliance Engineer Marshall has been programming professionally for 35 yearsHe is the author of Boost.Algorithm, and has been a contributor to Boost for more than 15 years. He is the chairman of the Library working group of the C++ standard committee. He is the lead developer for libc++, the C++ standard library for LLVM. — Videos Filmed & Edited by Bash Films: BashFilms.com Work at Hudson River Trading (HRT): tinyurl.com/safxfctfWhat people say. Recommended as an interesting talk on the complexities of writing a midpoint function and dealing with integer promotions.
u/foonathanin r/programming • Recommends
On “On finding the average of two unsigned integers without overflow”
u/keyboard_operatorin r/C_Programming • Recommends
On “According to me the 4th print statement should print -1 but why it is not hapenning?”