I tend to agree with Paolo Carlini's comment:

thus, unless I made a mistake in searching the Standards, on non-Posix
systems does not seem safe to not zero errno in advance. Would it be
safe to leave out the zeroing for the glibc implementation? I'm asking
for fclose and for fflush.

In that case, we could just remove 'errno = 0' for the GNU/Linux targets
we (Matthias too) care about via a __GLIBC__ macro check, and everyone
we'll be happy.

In any case, by setting errno to zero, the "principle of least surprise"
is being violated.  Either libstdc++ should change, or the manpage
should be rewritten to say "Oh, by the way, don't count on libstdc++
leaving your errno alone."  :)  Therefore I can't say I agree with
changing the status of this bug to invalid.

I do agree that the code I was debugging was broken (it has been fixed).
Debugging the problem was hard enough, but it was made *much, much*
harder when errno was unexpectedly cleared.  This is why my co-worker
and I bothered to post the bug report in the first place, so that
hopefully others don't experience the same problems.

Thank you for your time!
Chris Fester

** Changed in: gcc-4.4 (Ubuntu)
       Status: Invalid => Opinion

-- 
errno cleared by ofstream close or string conversion
https://bugs.launchpad.net/bugs/598299
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to