From: Chris Torek Date: Wed, 27 Oct 2021 22:13:54 GMT Subject: Re: [PATCH v2] add, rm, mv: fix bug that prevents the update of non-sparse dirs Message-ID: In-Reply-To: <00a67af9-da41-6df4-afc0-5ae7c7714bfd@gmail.com> On Tue, Oct 26, 2021 at 11:17 PM Derrick Stolee wrote: (regarding a pointer that "backs up one before the beginning of the array" as it were) > I also see the specification saying this is undefined, but I do not > understand how any reasonable compiler/runtime could do anything > other than store "path - 1" as if it was an unsigned integer. ... This Standard C rule dates back to old segmented systems. If you put some array A into its own segment, and use only the offset as the "pointer", and the segment offset starts at zero, then A[0] is at "address zero". So the imaginary element at A[-1] is at "address max", and a loop like: for (p = &A[N]; p >= &A[0]; p--) is an infinite loop. In practice nobody is using these architectures today, but the restriction still exists. Chris