|
|
|
|
|
by Animats
453 days 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=10... |
|
Nelson Elhage wrote about an alternate interpretation: https://blog.nelhage.com/2015/08/indices-point-between-eleme...