Hacker News new | ask | show | jobs
by dbyte 3773 days ago
auto with lambdas can be quite dangerous if you are adding different types inside their bodies. Type promotion rules should be well understood. During code reviews we spotted several overflow bugs when using ints because the dev were thinking auto as a sort of very powerful resource.

Explicit casting if often required to make sure subtle bugs won't show up in production.

2 comments

What do you mean about promotion rules with auto?
Couldn't that have been found by turning on the signed-to-unsigned conversion warning?