3 ms·
> ... Java, C and C++ have much weaker checks of correctness... It is confusing that people talk about C in terms of being a typed language. The types are an a
by roenxi 5y ago
> ... Java, C and C++ have much weaker checks of correctness...
It is confusing that people talk about C in terms of being a typed language. The types are an annotation so the compiler knows how much memory to allocate / read. All the side benefits of having to spell that out are incidental.
That sort of typing is a distraction. A programmer does not care that they are passing 4 bytes as the first argument. That isn't really trying to squeeze anything useful out of a type system. They care that they are passing something recognised as an ID, not that it has 4 bytes.
Using C/C++ as an example of a typed language doesn't say much. The guarantees are more a culture of how to use the language than in the language itself.
- kaba0 5y agoWith the same argument, why put C++ into the same bracket? It has much much more type safety than C.
- edflsafoiewq 5y agostruct ID { uint32_t val; }; void check_id(struct ID id);