Mixing wide and narrow string literals in C -


just found out of following work:

printf( "%ls\n", "123" l"456" ); printf( "%ls\n", l"123" "456" ); printf( "%ls\n", l"123" l"456" ); 

the output is

123456 123456 123456 

why can freely mix , match wide , narrow string literals wide string literal result? documented behavior?

is documented behavior?

yes, behavior supported standard, section 6.4.5 string literals paragrph 4 of c99 draft standard says (emphasis mine):

in translation phase 6, multibyte character sequences specified sequence of adjacent character , wide string literal tokens concatenated single multibyte character sequence. if of tokens wide string literal tokens, resulting multibyte character sequence treated wide string literal; otherwise, treated character string literal.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

image - ClassNotFoundException when add a prebuilt apk into system.img in android -