Earlier quoted context omitted.
Thanks for the excerpts! I was trying to understand the reasoning, which seem to just be in the 2nd excerpt: - The rules of signed/unsigned are complicated and there is too much auto-conversion - does that mean languages that make this more explicit means this is fine? It just seems ideal to have stronger typing. - It is mentioned that you can initialized an unsigned int to "-2" - but that presumably could also be fi…
Considering Rust doesn’t have such nonsense, I’m inclined C/C++ have utterly broken generations of programmers. In what world is using a signed value to index a normal array a good idea? Makes for horrible footguns like: history[counter % SIZE] = … (One cursed day counter rolls over, becomes negative, and an out-of-bounds write occurs) Everything went South as soon as we broke the abstraction of arrays and treated th…
> history[counter % SIZE] = …
The footgun here is that the “modulo” operator does not actually calculate the modulo in C. In Python, this works correctly for negative values.