CppCon 2018: Robert Ramey “Safe Numerics”

preview_player
Показать описание


Most computer languages, including C++, cannot guarantee that an integer expression will not produce a incorrect arithmetic result.

This fact is documented in numerous books, articles and conference presentations such as CPPCon. These presentations give good explanations of the problem and it's causes. But they are short on specific practical strategies to address the problem. The Boost.SafeNumerics library addresses this problem through C++ techniques such as operator overloading, template meta-programming. This library can be used to write C or C++ code guaranteed not to produce erroneous arithmetic results. In many cases, this guarantee can be made without adding any run-time overhead.

This presentation will

* illustrate some common problems such as integer overflows and type conversions.
* illustrate how the library can be used to address these problems.
* describe in general terms what the library does and how it works.
* describe the library API in some detail.
* present a case study applying the library to embedded motor controller written in C.

Robert Ramey, Robert Ramey Software Development
Software Developer



*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

Brilliant talk. It's a real shame you didn't get more of an audience, and I hope it was a horrible scheduling conflict rather than lack of interest. This kind of low level safety and compile-time verification is necessary for C++ to gain the interest of the embedded systems community. I like that you used a real world example of high practical importance, too - it extended your 2016 talk very nicely. Did you ever get in touch with David Austin?

jakearkinstall
Автор

Thank you for this talk Robert. I'm looking forward to using the library!

MichaelCaisse_ciere
Автор

Forgot to add - slides available at www.rrsd.com

robertramey
Автор

What a brilliant talk. This is pure gold!

estebanduran
Автор

Enjoyed this talk. Safe numerics should have been part of std long ago and should also have included floats.

KarelDonk
Автор

Those are some big chunks of deep insight.

gunnararndt
Автор

Nice work on this! It's unfortunate that we have to do all this jumping through hoops to check for overflow/underflow when the processor already has this information in the flags. What we really need is a standard way to easily get that information instead of having to do all this work to check for a possible overflow.

jeffreyandrews
Автор

This is excellent material and an excellent example use case. Thank you for the talk.

spirosfoufoutos
Автор

Thanks for the talk, I'll definitely try it out

lanowen
Автор

Sounds like Ada83, it took some years.
I know that you have to suppress these checks to get enough performance on embedded systems.

patsv
Автор

cool, but usability is limited. Any addition of 2 same integral types that are unbounded can overflow. No way to check against division by zero. No way to do advanced logic like doing analysis of loops(when loop iteration count is known at compile)

Voy