4 ms·
Keep it straight in your head, and use strict comparison. Hey, at least when JS implicitly converts your types, it actually does type conversion, rather than m
by qwertyuiop924 10y ago
Keep it straight in your head, and use strict comparison.
Hey, at least when JS implicitly converts your types, it actually does type conversion, rather than merely casting them, so you often get what you want (looking at you, C).
- tempodox 10y agoAs for C, I have to contradict you. Implicit (numeric) type conversions do actual conversions (like char to int, or int to double; even pathological cases like pointer to what-counts-as-Boolean-in-C). The casts you are talking about must be explicit, and thereby are squarely the programmer's responsibility. Of course, a language that forces all conversions to be explicit is preferable.
- qwertyuiop924 10y agoI was pretty sure that char to int/int to char in addition was implicit...
- tempodox 10y agoYes, but the char still has to be extended to int. Or the int truncated to char. Except on systems where they happen to be the same size. EDIT: Supplement: The notion of “type” in C is best translated as “memory layout plan”. Languages of the ML family (including Haskell), e.g., have a notion of “type” closer to mathematical concepts.