6 ms·
> It also requires code to explicitly set errno many, many times. Yes, errno should be cleared every time you want to check it. Although you can check it mult
by masklinn 4y ago
> It also requires code to explicitly set errno many, many times.
Yes, errno should be cleared every time you want to check it. Although you can check it multiple times with a single clear, as long as a set errno leads to an exit.
A more likely cause if the issue you outline is that errno is not context-local tho, so if you call something which causes errno to be set you might get an errno from an unexpected error. This is similar to overly broad exception contexts, but much harder to diagnose.