RE: 2 byte wide character support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Klaus,

Probably not what you want to hear, but if you're depending on the size of characters in your pointer arithmetic, then my inclination is to think that you're not doing things properly.  Pointer arithmetic normally automatically takes the size of the type into account for you.  Explicitly depending on the size of types like that is also a very unportable way to program.  You might just consider replacing all of your 2's with "sizeof(wchar_t)".  Then it shouldn't matter what size a character is.  Of course, I don't know exactly what it is you're trying to do, so this is just a shot in the dark...

Thanks,
Lyle


-----Original Message-----
From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On Behalf Of Klaus Winter
Sent: Friday, November 05, 2004 2:30 PM
To: gcc-help@xxxxxxxxxxx
Subject: 2 byte wide character support

Hi,

I'm currently porting a Windows application to Linux. After some easy issues
the code compiled fine wiht gcc 3.3.1 But mysteriously the code didn't do
what I expected it to do. After some time I found that widecharacters
(wchar_t) are 4 bytes in all GNU systems instead of the expected 2 bytes.
With setting the flag -fshort-wchar this problem was solved but another one
arose. Now most glibc functions handling widecharacters don't work properly
anymore. (currently I'm converting them back and forth to the value needed )
I'm looking for a better of handling this: perhaps enabling  functions like
wcscmp(...) to handle 2byte widecharacters. ( 2byte widecharacters are
NEEDED because of pointer arithmetic in the application ). Any help is
appreciated.

Klaus

-- 
NEU +++ DSL Komplett von GMX +++ http://www.gmx.net/de/go/dsl
GMX DSL-Netzanschluss + Tarif zum supergünstigen Komplett-Preis!



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux