Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 15 Nov 2012 16:36:31 +0400
From: Yuri Kozlov <yuray@...yakino.ru>
To: musl@...ts.openwall.com
Subject: Re: type of wchar_t

В Thu, 15 Nov 2012 12:53:40 +0100
Szabolcs Nagy <nsz@...t70.net> пишет:

> * Yuri Kozlov <yuray@...yakino.ru> [2012-11-15 13:09:50 +0400]:
> > 
> > arch/x86_64/bits/alltypes.h.sh
> > #ifndef __cplusplus
> > TYPEDEF int wchar_t;
> > #endif
> > 
> > 
> > arch/i386/bits/alltypes.h.sh
> > #ifndef __cplusplus
> > #ifdef __WCHAR_TYPE__
> > TYPEDEF __WCHAR_TYPE__ wchar_t;
> > #else
> > TYPEDEF long wchar_t;
> > #endif
> > #endif
> > 
> > (__WCHAR_TYPE__ is not defined everyware, so TYPEDEF long wchar_t;)
> > 
> > arch/arm/bits/alltypes.h.sh
> > #ifndef __cplusplus
> > TYPEDEF unsigned wchar_t;
> > #endif
> > 
> > 
> > Why type of wchar_t is so differs?
> > 
[...]
> c11 has generics (implemented in the compiler) so the
> compiler must have a type internally for L'' or L""[0]
> and wchar_t must be defined as that type
> 
> so we either use the __WCHAR_TYPE__ defined by the
> compiler (when it's defined), or use the abi specs
> (which gives the align+size+sign information and
> hopefully compilers agree on a single int type when
> there are multiple choices)

Thanks for clarification.
Hah, gcc emit a __WCHAR_TYPE__ for arm as unsigned. Wow.
$ arm-linux-gnueabi-gcc -dM -E - < /dev/null |grep __WCHAR_T
#define __WCHAR_TYPE__ unsigned int


-- 
Best Regards,
Yuri Kozlov

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.