Hacker News new | ask | show | jobs
by anonymoushn 1808 days ago
One of my least favorite bugs came from a loop that iterated from *p to *(p+n) (exclusive). For n=0 and values of p other than null, the loop body never executes. For n=0 and p=null, the loop body is allowed to execute, because null+0 is allowed to be any value.
1 comments

Nice example! Seems solvable by printf debugging though..
The fact that it’s fixable doesn’t mean it’s fun…