4 ms·
> At least we're not stuck with the Roman "inclusive counting" system that included one extra number in ranges* so that e.g. weeks have "8" days and Sunday is t
by Animats 2y ago
> At least we're not stuck with the Roman "inclusive counting" system that included one extra number in ranges* so that e.g. weeks have "8" days and Sunday is two days before Monday since Monday is itself included in the count.
Yes, we are. C gives pointers one past the end of an array meaningful semantics.
That's in the standard. You can compare them and operate on them but not de-reference them.
Amusingly, you're not allowed to go one off the end at the beginning of a C or C++ array. (Although Numerical Recipes in C did it to mimic FORTRAN indices.) So reverse iterators in C++ are not like forward iterators. They're off by 1.
[1] https://devblogs.microsoft.com/oldnewthing/20211112-00/?p=105908 https://devblogs.microsoft.com/oldnewthing/20211112-00/?p=10...
- taco9999 2y ago> C gives pointers one past the end of an array meaningful semantics Nelson Elhage wrote about an alternate interpretation: https://blog.nelhage.com/2015/08/indices-point-between-elements/ https://blog.nelhage.com/2015/08/indices-point-between-eleme...