3 ms·
> Weak typing is more about the runtime behavior of values — if I try to use a value of type T as though it were of type U, will it be implicitly converted? >
by wahern 9y ago
> Weak typing is more about the runtime behavior of values — if I try to use a value of type T as though it were of type U, will it be implicitly converted?
> C lets you assign pointers to int variables and then take square roots of them, which seems like a bad idea to me. C++ agreed and nixed this
No, it doesn't. There's no implicit conversion of arithmetic types to pointer types in assignment. You have to manually cast, just like in C++. There's no implicit conversion between pointer types, either; and there's no explicit conversion between compound types, period (type punning necessarily requires abusing pointers). C is basically no weaker than most of the other languages mentioned.
- wahern 9y ago> "Strings" in C are arrays of 8-bit characters. Again, no. char types are at least 8 bits, but can be larger (e.g. on old mainframes or modern DSPs).