This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Legalize access to file descriptors now! (So sue me.)
On Thu, Feb 17, 2005 at 11:22:34AM +0000, Jonathan Wakely wrote:
> On Wed, Feb 16, 2005 at 11:56:29PM +0100, Richard B. Kreckel wrote:
>
> > Since we've had the discussion whether to allow access to file descriptors
> > from C++ stream objects more than once without any result, I've had to
> > hack my way through to the file descriptors by applying a good amount of
> > brute force (not to mention all the beer).
> >
> > So, here is my lament: http://www.ginac.de/~kreckel/fileno/. Could you
> > folks please, please make the access a little bit more smooth? We need
> > the
> > file descriptor. We are going to get it. Don't prolong the agony.
"at least all the ugly stuff is completely hidden away inside a
compiled function and the interface is clear and pristine"
Is that valid? Doesn't a definition of fileno() have to be visible
when it's used?
To achieve what you want fileno() would have to be a non-template
function, overloaded for std::basic_ios<char> and
std::basic_ios<wchar_t>. The definitions of those overloads could then
use fileno_hack() which can be private to the file containing the
function definitions.
Or am I wrong about how function templates are instantiated?
jon
--
"I find television very educating. Every time somebody turns on the set,
I go into the other room and read a book."
- Groucho Marx