What's the difference between glib gunichar and wchar_t and which is better for cross-platform solutions?
问题 I'm trying to write some C code which is portable only so far as the user has gcc , and has glib installed. From all my research, I've found that with gcc , a wchar_t is always defined as 4 bytes, and with glib a gunichar is also 4 bytes. What I haven't figured out is if like a gunichar , a wchar_t is encoded as UCS4 as well. Is this the case? If so, I should be able to simply cast a gunichar* to a wchar_t* and use the stdc wcs* functions, right? 回答1: If you use GLib, don't use wchar_t . Use