Possible Clang Bug in Initializing Wide String From String Literal?
Possible Clang Bug in Initializing Wide String From String Literal?
- Subject: Possible Clang Bug in Initializing Wide String From String Literal?
- From: Andreas Grosam <email@hidden>
- Date: Thu, 19 May 2011 17:56:26 +0200
The code below ...
// main.c
// UTF8-encoded source file
#include <stdio.h>
#include <wchar.h>
int main (int argc, const char * argv[])
{
char s[] = "ü";
wchar_t ws[] = L"ü";
printf("number of characters in narrow string: %lu\n", sizeof(s)/sizeof(char) - 1 );
printf("number of characters in wide string: %lu\n", sizeof(ws)/sizeof(wchar_t) - 1 );
printf("\n");
return 0;
}
... yields the following with gcc 4.2:
number of characters in narrow string: 2
number of characters in wide string: 1
and with clang (Xcode 4.0.2):
number of characters in narrow string: 2
number of characters in wide string: 2
IMHO, if I read the standard correctly, clang seems to make an error here. I hope I'm terrible wrong here, since this is pretty basic stuff. Is there something left to be "implementation defined" what I may have overlooked?
Andreas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden