This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [libstdc++] Don't access fpos_t.__state on uClibc w/o wchar support
- From: Bernardo Innocenti <bernie at develer dot com>
- To: Pétur Runólfsson <peturr02 at ru dot is>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>, GCC Patches <gcc-patches at gcc dot gnu dot org>, libstdc++ at gcc dot gnu dot org
- Date: Thu, 25 Sep 2003 22:29:05 +0200
- Subject: Re: [libstdc++] Don't access fpos_t.__state on uClibc w/o wchar support
- Organization: Develer S.r.l.
- References: <07D05A69A3D0C14FAEA60C3ACE8E5564028F55CF@mail.ru.is>
Pétur Runólfsson wrote:
We just need to disable code that needs that missing member and
perhaps return a default value instead.
If your platform doesn't support any stateful conversions, then this
seems reasonable, but in general less platform-specific code is
usually better.
It does, but I've disabled mbchar/wchar support to reduce the
C library size.
Typical embedded applications don't need that, expecially
when they have no human interface.
I also have a philosophical question: does libstdc++ need to
provide all the features mandated by the standard even when
the underlying C library doesn't support them properly?
Depends on what you mean by need :-)
Well, does it make sense to provide a full blown public
interface as mandated by the standard even when sume
functionality cannot be implemented because of missing
support from the underlaying system?
And even if some of them could be made to work somehow,
wouldn't it be useful to have a way to turn off advanced
functionality to make the library smaller or more efficient
for small systems?
In embedded projects, I'd rather like an incomplete libstdc++
than a needlessly fat one. I don't use locales, UTF8 or wide
streams, therefore I'd like to drop all code for dealing with
them.
Ideally, the linker should be able to discard those parts of the
library that are not used. It may need some help though, such as
splitting up source files and using weak symbols. #ifdefs to
reduce code size should be used only as a last resort (if at all).
If we unconditionally add a member variable of type mbstate_t in
class fpos, all instances will end up being bigger. Even worse, the
compiler won't be able to pass fpos objects around as scalars because
they would now be real structures with multiple fields.
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/
Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html