This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: filebuf::fd()
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- To: Phil Edwards <pedwards at disaster dot jaj dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: 03 Dec 2001 07:53:32 +0100
- Subject: Re: filebuf::fd()
- Organization: CodeSourcery, LLC
- References: <20011203010027.A13939@disaster.jaj.com>
Phil Edwards <pedwards@disaster.jaj.com> writes:
| I'd really like for us to decide on a way to conditionalize these extensions
| (e.g., my posting on 29 Sept, item #2).
|
| Anyhow, by popular-and-IMHO-slightly-misguided demand, here's a way for
| filebuf's to return an underlying file descriptor, for the currently
| default --enable-cstdio=stdio case. I did not investigate the libio case.
|
| Also some cleanups:
| 1) for is_open, make it clear that we're comparing pointers.
Well, I think the code was clear as written, and I don't think the
change is necessary.
| 2) for the testcase file, when our non-standard signature was changed,
| the comment was not. Also <cassert> is included in the hooks header.
|
| Opinions?
Recent discussions ont the LWG list make me nervous about adding
extensions, but hey we have to deal with some users requests.
I discussed the issue with Theo two weeks ago. I think returning a
FILE* would be self-contained in terms of semantics. That is, isntead
of retuning an int (the file descriptor), have a member function --
say FILE_pointer() -- return a FILE*. That scheme is extensible to
libio.
| template<typename _CharT>
| bool
| - __basic_file<_CharT>::is_open() { return _M_cfile != 0; }
This change is uncessary.
| + int
| + fd();
| +
Replace this with
+ #ifdef _GLIBCPP_USE_EXTENSIONS
+ FILE*
+ FILE_pointer();
+ #endif
-- Gaby