This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Accessing the UNIX file descriptor inside an fstream
- To: Chris Rankin <rankinc at pacbell dot net>
- Subject: Re: Accessing the UNIX file descriptor inside an fstream
- From: Zack Weinberg <zack at codesourcery dot com>
- Date: Fri, 14 Sep 2001 22:35:33 -0700
- Cc: libstdc++ at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- References: <200109150420.f8F4KCu17156@twopit.underworld>
On Fri, Sep 14, 2001 at 09:20:12PM -0700, Chris Rankin wrote:
> Hi,
>
> Yes, I am fully aware that this topic has been brought up before. I
> have found numerous references in the mailing list going back to
> January 2000. However, I doubt that you'll make it go away by ignoring
> it, especially since libstdc++-v3 is now part of gcc.
>
> I am (was) trying to port some C++ code from g++-2.95.3 to g++-3.0.1
> and the showstopper problem was this single line:
>
> fcntl(m_file.rdbuf()->fd(), F_SETFD, FD_CLOEXEC);
Given the existence of the extended basic_filebuf constructor, I think
it would be reasonable to provide an operator FILE *() member on
basic_filebuf. This would allow rewriting that as
fcntl(fileno(static_cast<FILE *>(m_file.rdbuf())), F_SETFD, FD_CLOEXEC);
which fits with the way the standard library seems to work.
Chris is right, people do need this functionality and it doesn't serve
our users to deny them it on pedantic conformance issues.
zw