3 ms·
He has the source code, I guess these comments are from original source code.
by bluesign 6y ago
He has the source code, I guess these comments are from original source code.
- SV_BubbleTime 6y agoOh I get that. My comment was still how easily this could be missed even with source. Maybe it’s just me, but I rarely use ptr++ to jump over like that. I’m more likely to use ptr[1] that isn’t “destructive” to the location you started with.
- cirno 6y agoIt saves you needing a separate index variable. If you're doing something like LZSS decompression it makes the relative window offsets natural (absolute). Not sure I'd recommend coding like that today, unless ptr was a smart pointer that had bounds checking, but for the time period it was a perfectly fine technique.
- tom_ 6y agoBut the destructive nature of ++wptr or whatever can be to its advantage, in that you never need to update any numbers when things change. The data is consumed/produced in the order specified, a property that is maintained even after new operations are inserted or existing operations are reordered. (Whether you want this or not, who can say! - though I claim you typically do.)