public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: lrtaylor@micron.com
To: <kwinter1@gmx.de>, <gcc-help@gcc.gnu.org>
Subject: RE: 2 byte wide character support
Date: Fri, 05 Nov 2004 22:20:00 -0000	[thread overview]
Message-ID: <363801FFD7B74240A329CEC3F7FE4CC40215DC5B@ntxboimbx07.micron.com> (raw)

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@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Klaus Winter
Sent: Friday, November 05, 2004 2:30 PM
To: gcc-help@gcc.gnu.org
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!

             reply	other threads:[~2004-11-05 22:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-05 22:20 lrtaylor [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-11-05 21:30 Klaus Winter
2004-11-05 21:57 ` Ken Foskey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=363801FFD7B74240A329CEC3F7FE4CC40215DC5B@ntxboimbx07.micron.com \
    --to=lrtaylor@micron.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=kwinter1@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).