[uClibc] wchar size

Carlos de carlos_desa at yahoo.com
Tue Aug 2 19:09:33 UTC 2005


Hi
Seems like i've back to my same problem ...
On digging a bit furthur I found that that 
__WCHAR_MIN and __WCHAR_MAX only define the max limits
of the wchar_t type. The actual definition of wchar_t
seem to be taken from gcc as the actual
definition/typedef of wchar_t in include/inttypes.h
(in uClibc src)  depends on __gwchar_t or
__WCHAR_TYPE__ ( one for a c++ toolchain and the other
for a c toolchain apparently) both which are defined,
or seems to be,in the gcc header 
gcc/ginclude/stddef.h in gcc src.
However here i seem to have run short of luck as
despite changes both in stddef.h and inttype.h wchar_t
still is stuck at 4 bytes as can be verified from a
simple sizeof program. 
>From the compiled toolchain the actual definition f
wchar_t seems to depend on __WCHAR_TYPE__ as defined
in
arm-linux-uclibc/lib/gcc-lib/arm-linux-uclibc/3.3.6/
include/stddef.h
For your information i am building a arm-920t
(s3c2410a) c,c++ toolchain using binutils-2.15,
gcc-3.3.6, uclibc-0.9.27 and would _not_ be doing any
conversions from wchar_t for multibyte or vice-versa.

Any help/suggestions on how to keep the size of
wchar_t fixed at 2 bytes? 

thanks
Carlos 

--- Manuel Novoa III <mjn3 at codepoet.org> wrote:

> On Wed, Jul 13, 2005 at 04:24:31AM +0100, Carlos de
> wrote:
> > Hi
> > I've started using the uclibc toolchain and
> buildroot
> > recently for a s3c2410x / arm920t  porting
> project.
> > However ive run into a problem which I'm not
> really
> > too sure how to solve. 
> > >From what ive found in the changelogs and src
> code it
> > seems that wchar size is fixed at 31 bits based on
> the
> > macros __WCHAR_MIN and __WCHAR_max defined in
> libc/
> > sysdeps/linux/common/bits/wchar.h as
> (-2147483647-1)
> > and 2147483647 respectively. 
> > My problem is that most of the existing code that
> is
> > to be ported assumes that this is a 16bit value.
> Hence
> > i need to change the wchar size from 31 to 16 bits
>  (
> > or perhaps 15 bits ? i assume this is to avoid the
> > sign bit). 
> 
> I'm assuming your limiting yourself to 16 bit
> unicode?
> 
> > Thus would this just mean a change of the above
> macros
> > and WEOF  in include/wchar.h ? I couldnt find any
> 
> Depends on what you want to do.  If all you want to
> do is
> pass around 16 bit wchar values, that would likely
> be sufficient.
> But if you want to convert back and forth between
> wchar and
> multibyte, things get a lot more complicated.  Note
> that this
> includes using any of the wide stdio functions.
> 
> > configuration option for the above. Or perhaps
> there
> > is  some other way - patch,etc ?
> 
> I had actually intended to support 16 bit wchar as
> an option.
> But it was more of a "this would be cool" thing than
> a definite
> goal.  I know of at least one thing that would
> break, and I can
> think of several others that would have to be
> checked out.
> 
> > If my (seemingly naive !) suggestion is correct
> then
> > one Q regarding WEOF  -  it seems to be be defined
> in
> > include/wctype too . would this need to be changed
> > too?
> 
> Changing the value of WEOF would be just a starting
> point...
> 
> Manuel
> 



	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com



More information about the uClibc mailing list