[uClibc] wchar size

Manuel Novoa III mjn3 at codepoet.org
Wed Jul 13 04:52:13 UTC 2005


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



More information about the uClibc mailing list