It's just one of those things where one day you'll be sitting in front of a problem, and it'll suddenly be obvious you need a negative index.
God, I hope not.
God, I hope not.
God, I hope not.
It's been a while, but I once used negative indexes when processing audio samples (or any time-series of samples, actually). The most natural way to express it was as t[-1], t[0], t[1] for some position of t. That's not the only way to do it, but it was the clearest in that case.
Well, my day job involves a lot of imaging processing. Would coding in that manner speed things up?
Yeah, if you want to learn x86 or x64 assembly language, it can be quite useful. ;-)Some what afraid to ask. But is all this an intellectual exercise in an unintended consequence of C's design or can it serve a real purpose?
LZ77/LZ78-based algorithms like deflate in zlib (used in PNG and Apples zlib compressed .dmg files and .xar (.pkg PackageMaker) files (Software Updates)) require "negative" indices. Or if you want to apply a filter to a CG-image. Many applications...Pointer arithmetic is an important part of C - used it myself on occasion; but what code might actual require a negative index; or I have missed something in this discussion.
Unroll your loops, and let the compiler recognize, which loops are "over-optimized". ;-)You won't know until you benchmark your particular code. Removing branches (x+i < 0, etc.) might help the compiler unroll more loops.