Hacker News new | ask | show | jobs
by Orphis 1810 days ago
I don't have that much experience migrating codebases from JS to TS, but I do have experience converting codebases from C to C++. The corollary is that C++ is typesafe while C isn't. So you can call a function taking a point to an int with a pointer to a double, and the compiler won't complain (too much).

Word on the street says that C programmers are usually expert engineers that know what they're doing. Yet, I had to deal with those conversion errors all the time. That C code isn't a random CRUD application on a simple website. That can be software embedded in controllers in sensitive equipment, or equipment that will be harder to update. So it's even more important to get it right. And yet...

1 comments

In C if you pass a pointer to double to a function expecting a pointer to int, that is a constraint violation (see 6.5.16.1 in the standard), and the compiler is required to emit a diagnostic.