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

Excellent docs on numeric casting in C++ #38

Open
springmeyer opened this issue Oct 12, 2017 · 1 comment
Open

Excellent docs on numeric casting in C++ #38

springmeyer opened this issue Oct 12, 2017 · 1 comment

Comments

@springmeyer
Copy link
Contributor

springmeyer commented Oct 12, 2017

Without strict compiler warnings, it is possible to write quite a bit of C++ without it be obvious once needs to study the details of numeric casting. Implicit conversion will convert various integer types to other integer types and to floating point types, quietly and hopefully correctly.

Because we can't have correct code based on hope, we should instead enable warnings from the get go that warn about implicit conversion and specifically truncating or narrowing conversion and convertions that might overflow.

So, we want to enable warnings like -Wconversion per #37.

What this means is that you'll get loud warnings right away about converting types and will need to figure out how to avoid or suppress them correctly, to fix the potential existing bugs they hint at and avoid creating new bugs in the process.

Refs mapbox/node-cpp-skel#78 (comment) mapbox/carmen-cache#94
refs mapbox/gzip-hpp#19 (comment)

/cc @mapsam @GretaCB @flippmoke

@springmeyer
Copy link
Contributor Author

More goodness coming in latest clang++ https://blog.regehr.org/archives/1633

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

No branches or pull requests

1 participant