This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


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

Re: i18n: done


Ulrich Drepper wrote on 2001-02-02 20:10 UTC:
> Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> writes:
> 
> > In other words, I'd wish that the following test always passes under
> > glibc:
> > 
> >   assert(fwide( stdin, -1) == -1);
> 
> This is undesirable since it's not portable

In my opinion, it is both portable and desirable!

Being able to change the orientation of a stream is the primary function
of the fwide function after all, and I can't believe that glibc doesn't
implement that yet, just because it is optional. The ISO C committee
just forgot to require it as useful functionality for the standard
streams in this version of the standard and I very much hope that either
the next revision of ISO C or POSIX will add a requirement for it, not
just the possibility.

The standard certainly does not prevent you from providing this useful
and easy to implement functionality.

The standard provides you with a portable way of telling the application
whether you did change the orientation or not, namely via the fwide
return value.

Let's not patronize application developers by not providing even the
slightest functionality that is not made unambiguously mandatory by
ISO C. That has nothing to do with portability. If an API function is
allowed to fail, it is definitely not good standard library engineering
to make it fail each time unless there is very a good independent
technical reason. But that is what you are saying here if I understood
you correctly.

If fwide works under Linux properly, this will encourage authors of
other POSIX APIs to implement it as well properly. Please set a good
example with your implementation instead of raising this somewhat
far-fetched portability concern.

> and has other nasty side effects.

Such as?

I can see potentially interactions with file positioning. But stdin/
stdout/stderr do not have file positions! So there will at least not be
any nasty side effects for these three. I agree that the problem can be
circumvented for most other files via reopen (which has perhaps a
cleaner semantics with regard to file positions), but *not* for the
standard streams. That is why fwide exists primarily but it is not
implemented to serve its purpose in glibc 2.2.1!

> Fix the programs.

There are no programs using the wide functions out there yet. There will
hardly be any using wide functions on the standard streams if streams
get tied forever to one single orientation. :-(

Markus

-- 
Markus G. Kuhn, Computer Laboratory, University of Cambridge, UK
Email: mkuhn at acm.org,  WWW: <http://www.cl.cam.ac.uk/~mgk25/>


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