This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: size of wchar_t
- From: llewelly at xmission dot com
- To: "Artem B. Bityuckiy" <abityuckiy at yandex dot ru>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 31 Mar 2004 12:55:35 -0700
- Subject: Re: size of wchar_t
- References: <406B0506.3050007@yandex.ru>
"Artem B. Bityuckiy" <abityuckiy@yandex.ru> writes:
> Hello.
>
> I need to determine size of wchar_t type at compile-time.
What do you mean by 'compile time'? sizeof(wchar_t) is compile time
constant, but it isn't availibe for preprocessor conditionals.
> Is there
> some macro to find sizeof(wchar_t).
I can't find one. However, C99 requires <wchar.h> and <stdint.h> to
provide WCHAR_MIN and WCHAR_MAX. You didn't say which C library
you were using, but it would be easy to check. They are not quite
what you want, but maybe they are close enough.
> Specifically, I need to know is
> wchar_t 2 bytes or more. I tried to use WCHAR_TYPE_SIZE macro but it
> isn't defined by gcc (I use arm-elf-gcc, v3.2). I also want such macro
> be defined on any target.
[snip]
The above macros are C99-specifc. :-( .