Accessing the UNIX file descriptor inside an fstream

Gabriel Dos Reis gdr@codesourcery.com
Sat Sep 15 11:51:00 GMT 2001


Zack Weinberg <zack@codesourcery.com> writes:

| 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

This is an old issue.  No body is denying the need for a category of
prgrammers for non-standard extensions.  
However, I'm not at all convinced that what is proposed at the current
level of developement is the right solution.  The nonstandard
interfaces are not stabilized yet.  It is hard to remove a
non-standard feature once it is in and documented.  It is not an overly
anal pedantic conformance issue.

A better solution is to extend the IOSttream hierarchy for FILE*-based
stream -- there are some implementations around there.

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com



More information about the Libstdc++ mailing list