This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Accessing the UNIX file descriptor inside an fstream


On Mon, Sep 17, 2001 at 01:27:46PM -0700, Scott Johnston wrote:
> Phil Edward's has stated that in his opinion fd-related extensions to
> filebuf
> are out of the question, because the software does not know about the
> underlying file descriptors.  But the software could be made to know
> about this, at least for POSIX copies of libstdc++-V3.

Well, it is only my opinion.  I just work here.  :-)

I'm trying to strike a balance between exposing the guts (which might
change, and aren't portable) and completely hiding the guts (which is
too restrictive).  I feel exposing the underlying data pointer -- that is,
the same level of abstraction used in the filebuf code itself -- would be
enough for those programmers who know C and know their platform.

For 3.0, we simply forwarded to a FILE*.  Exposing that would be enough,
I'd think.


> I understand there might be synchronization issues that crop up using
> different kinds of I/O objects simultaneously (FILE*'s, file
> descriptors,
> iostreams).   There certainly were with libg++ and earlier libstdc++'s.
> But these can be solved like they were in the past.

Absolutely.  The users would have to sync these, as they would any other
multiple use of resources outside the control of a class.


Phil

-- 
Would I had phrases that are not known, utterances that are strange, in
new language that has not been used, free from repetition, not an utterance
which has grown stale, which men of old have spoken.
                                     - anonymous Egyptian scribe, c.1700 BC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]