Comment by lelanthran

16 days ago

That's my point - they didn't, and used the zero as a sentinel when designing their HLL.

If, OTOH, the ISA had additional variants of those instructions that allowed usage of anything as a sentinel, HLL implementations of array would never have needed a fat pointer (length + memory).

Except that the ISA has a perfectly good ALU there that can detect zero really easily, so no one was going to waste silicon on an instruction that required comparison to yet another value (which essentially would be an additional subtraction or OR or equivalent) added to the loop.

The fat pointers are much more efficient in that you don't need to scan memory to get the length or find the end to append or take slices etc.

Especially for vectors that don't have any value that can be used as a sentinel.