Of wchar_t
April 07, 2009
wchar_t was introduced long ago as wider version of char that should be enough while doing programs that grok Unicode. Unfortunately, as with all other C types the standard doesn't define the length. Thus some platforms have 2 byte others 4 byte wchar_t. I decided to check what are the sizes using an internal build tool at SUN/MySQL. And here are the results.
On the different platforms the native compiler was used. For example on Solaris Sun Studio was used. Linux, FreeBSD and MacOSX use gcc. Windows uses Visual Studio 8.
AIX 5.2 - ppc32 = 2
AIX 5.2 - ppc64 = 4
AIX 5.3 - ppc32 = 2
AIX 5.3 - ppc64 = 4
FreeBSD 6 x86 = 4
FreeBSD 6 x86_64 = 4
FreeBSD 7 x86 = 4
FreeBSD 7 x86_64 = 4
HPUX 11.11-hppa32 = 4
HPUX 11.11-hppa64 = 4
HPUX 11.23-ia64 = 4
i5OS - ppc32 = 2
i5OS - ppc64 = 4
Linux ia64 = 4
LinuxRHEL4 ia64 = 4
LinuxRHEL4 x86 = 4
LinuxRHEL4 x86_64 = 4
LinuxRHEL5 ia64 = 4
LinuxRHEL5 x86 = 4
LinuxRHEL5 x86_64 = 4
LinuxSLES9 ia64 = 4
LinuxSLES9 x86 = 4
LinuxSLES9 x86_64 = 4
LinuxSLES10 ia64 = 4
LinuxSLES10 x86 = 4
LinuxSLES10 x86_64= 4
MacOSX 10.4 ppc32 = 4
MacOSX 10.4 ppc64 = 4
MacOSX 10.4 x86 = 4
MacOSX 10.5 x86 = 4
Solaris8 sparc32 = 4
Solaris8 sparc64 = 4
Solaris8 x86 = 4
Solaris9 sparc32 = 4
Solaris9 sparc64 = 4
Solaris9 x86 = 4
Solaris10 sparc32 = 4
Solaris10 sparc64 = 4
Solaris10 x86 = 4
Win32 (VC8) = 2
Win64 (VC8) = 2