3 ms·
C++ is obviously hilariously less type safe than JavaScript. JavaScript will convert values from one type to a other at runtime but it's always absolutely sure
by JonChesterfield 2y ago
C++ is obviously hilariously less type safe than JavaScript.
JavaScript will convert values from one type to a other at runtime but it's always absolutely sure what the type of the value is.
C++ will compile code that looks reasonable, decide it's UB, not tell you about that and proceed to do abject nonsense at runtime.
Considering C++ the more "type safe" one of the two is so far from accurate that I wonder if you've mistyped the name of one of the languages.
- eru 2y agoI have a lot of sympathy for your point of view. Though have a look at Rust: it's generally considered much more typesafe than both JavaScript and C++, but it also has (some) dark corners of undefined behaviour with approximately all the same baggage as C++. See also https://news.ycombinator.com/item?id=8206562 https://news.ycombinator.com/item?id=8206562 for a different point of view: dynamically typed languages are equivalent to statically typed languages with just a single static type.