This is the mail archive of the
mailing list for the GCC project.
Re: stderr vs. STDERR_FILENO
Jonathan Lennox <email@example.com> writes:
| Zack Weinberg <zack at codesourcery dot com> writes:
| > For what it's worth I think this is primarily a documentation issue -
| It just occured to me -- no, unfortunately, this is a correctness issue.
| This C++ program is well-defined by the standard -- it invokes
| std::terminate, which invokes abort().
| #include <cstdio>
| #include <stdexcept>
| int main()
| throw std::runtime_error("Boom!");
| However, given a general-purpose C library which complies only with the
| requirements of the C/C++ standards, __gnu_cxx::__verbose_terminate_handler
| invokes undefined behavior on this program.
Which would strongly argue for keeping file descriptor 2.