As someone who only writes C or C++ occasionally, I'd consider this a good submission for an obfuscated C contest.
It really does look simple at first glance.
Then you start to wonder what the stop condition is.
Then you realize the i-- is the stop condition.
Then you wonder how the whole thing works at all.
(The description explained the trick well, and the construct makes sense once you understand it, but I still think this is one example of something that is "too simple" and becomes cryptic)
After all the stuff you hear about undefined behavior, I'm also honestly surprised that wraparound on unsigned types is not undefined behavior.
As someone who only writes C or C++ occasionally, I'd consider this a good submission for an obfuscated C contest.
It really does look simple at first glance.
Then you start to wonder what the stop condition is.
Then you realize the i-- is the stop condition.
Then you wonder how the whole thing works at all.
(The description explained the trick well, and the construct makes sense once you understand it, but I still think this is one example of something that is "too simple" and becomes cryptic)
After all the stuff you hear about undefined behavior, I'm also honestly surprised that wraparound on unsigned types is not undefined behavior.