Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile-time-unit-arithmetic/ #1

Open
utterances-bot opened this issue Apr 17, 2020 · 1 comment
Open

compile-time-unit-arithmetic/ #1

utterances-bot opened this issue Apr 17, 2020 · 1 comment
Labels

Comments

@utterances-bot
Copy link

Compile time unit arithmetic in C++ - Mara's Blog

In Software for Infrastructure, Bjarne Stroustrup shows a way to use templates to make the C++ compiler aware of the unit of a value (e.g. kilograms, seconds, etc.), such that it can check consistent use and prevent disasters like the well known error at NASA in 1999 caused by mixing incompatible units. In this article, I show how to extend this idea to support any number of base units and linearly related units (e.g. centimetres, metres and inches) by teaching the compiler how to do arithmetic on units.

https://blog.m-ou.se/compile-time-unit-arithmetic/

@m-ou-se m-ou-se added the comments label Apr 17, 2020 — with utterances
Copy link

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1935r2.html address Units problem for C++ standard. Then for example there is https://github.com/LLNL/units that lists many other alternatives as well. I hope for standardization one day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants