You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Zeid Derhally <de...@metrowerks.com> on 2003/04/28 15:08:46 UTC

GCCDefs.cpp, XMLCh, wchar_t

Are there any issues with setting XMLCh in GCCDefs.cpp to "wchar_t"
instead of unsigned char when using GCC on linux or solaris?  Right now
it is set to unsigned short.  I know that wchar_t is 4 bytes with gcc
and that is sort of a waste of space if all you need is 2 bytes.

The problem we have is that you can't use wide character string literals
directly in code when using Xerces.  It is also hard to use strings from
Xerces with wide character routines found in the C library and STL.

I'm curious what other people have done to work around this issue.

Any comments or ideas would be great.

Thanks.

Zeid

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: GCCDefs.cpp, XMLCh, wchar_t

Posted by da...@us.ibm.com.



Hi Zeid,

You absolutely should not do this, because you will break many things in
the system.  Both XML and DOM specify UTF-16 should be used internally, and
that won't be the case if you change XMLCh from 16 bits to 32 bits.  If
wchar_t is 32 bits, your compiler is not generating wide character strings
which are UTF-16 code points, and Xerces-C assumes anything in XMLCh is a
UTF-16 code point.  Also, the compiler's library routines probably don't
expect UTF-16 code points, so they are not likely to work properly either.

wchar_t is not very good for code portability, which is the major concern
for a library like Xerces.  That's why it's only used when it's known to
contain UTF-16 code points.  If you're not convinced, you work for a
compiler vendor, so have a discussion with the appropriate people in your
company about what the C++ standard says regarding the encoding for
wchar_t.

Dave



                                                                                                                                 
                      "Zeid Derhally"                                                                                            
                      <derhally@metrow         To:      <xe...@xml.apache.org>                                            
                      erks.com>                cc:      (bcc: David N Bertoni/Cambridge/IBM)                                     
                                               Subject: GCCDefs.cpp, XMLCh, wchar_t                                              
                      04/28/2003 06:08                                                                                           
                      AM                                                                                                         
                      Please respond                                                                                             
                      to xerces-c-dev                                                                                            
                                                                                                                                 




Are there any issues with setting XMLCh in GCCDefs.cpp to "wchar_t"
instead of unsigned char when using GCC on linux or solaris?  Right now
it is set to unsigned short.  I know that wchar_t is 4 bytes with gcc
and that is sort of a waste of space if all you need is 2 bytes.

The problem we have is that you can't use wide character string literals
directly in code when using Xerces.  It is also hard to use strings from
Xerces with wide character routines found in the C library and STL.

I'm curious what other people have done to work around this issue.

Any comments or ideas would be great.

Thanks.

Zeid

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org