Woj*_*ilo 3 c++ unicode string-literals switch-statement c++11
我今天遇到了一个非常奇怪的问题.让concider得到以下代码:
int llex(){
cout<<"enter 1"<<endl;
char32_t c = U'(';
cout<<(c==U'#')<<endl;
switch(c){
case U'#':
cout<<"enter 2"<<endl;
return 5;
default:
break;
}
}
int main( int argc, char** argv)
{
cout<<"enter 1"<<endl;
char32_t c = U'(';
cout<<(c==U'#')<<endl;
switch(c){
case U'#':
cout<<"enter 2"<<endl;
return 5;
default:
break;
}
cout << "------------" << endl;
llex();
}
Run Code Online (Sandbox Code Playgroud)
输出是:
enter 1
0
------------
enter 1
0
enter 2
Run Code Online (Sandbox Code Playgroud)
请注意,main中的代码对于llex
函数中的代码是IDENTICAL .他们为什么输出不同的结果 (我在clang上使用C++ 11).
归档时间: |
|
查看次数: |
349 次 |
最近记录: |