logoalt Hacker News

Groxxyesterday at 11:36 PM1 replyview on HN

that argument (and many others) also round to essentially "implicit imprecise integer casting is surprising but we do it anyway" which is... perhaps the actual problem???

I've made lints for Go that simply disallow implicit number casting, and omfg the (real, occurring but unnoticed) bugs it found. those kinds of lints are trivial to build, you can just stop doing it. forcing visible casts made many of these problematic patterns extremely suspicious at a glance, catching issues at review time far more easily.


Replies

a_t48today at 12:26 AM

I believe there's ways to configure clang to flag dangerous implicit casts as well.

show 1 reply