|
-
April 27th, 2017, 03:04 AM
#1
porting from VC++ wstring to Linux gcc
I am porting software with wstring inside it to Linux gcc . GCC supports -fshort-wchar that switches wchar_t from 4, to two bytes. I do not know whether it is working or not. I am having a problem with getting number of characters in wstring.
g++ -E -dD -xc++ /dev/null | grep WCHAR
#define __WCHAR_TYPE__ int
...
#define __SIZEOF_WCHAR_T__ 4
So wchar_t is 4 byte long.
In relation to that gcc manual states:"-fwide-exec-charset=charset
Set the wide execution character set, used for wide string and character constants. The default is UTF-32 or UTF-16,
whichever corresponds to the width of wchar_t. ..... however, you will have problems with encodings that do not fit exactly in wchar_t."
What does it mean ? I have to use UTF-16 and wchar short? Or wchar wide with UTF-32? What problem they are talking about?
I thought that wchar_t has nothing to do with unicode. It is a distinct type which can hold all members of the largest extended character set of all supported locales?
What could be the best setup for porting VC++ wstring to Linux Ubuntu?
-
May 7th, 2017, 09:57 AM
#2
Re: porting from VC++ wstring to Linux gcc
std::wstring is a built-in class of C++ Standard Library for handling unicode strings.
What's the point of porting or re-writing it when it is already present in the most standard-compliant compiler, including GCC?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|