Wiki Markup |
---|
According to \[[MISRA 08|AA. C References#MISRA 08]\], concatenation of wide and narrow string literals leads to undefined behavior. This is an inplicitimplicit undefined behavior according to C99 \[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\]. |
...
This noncompliant code example concatenates wide and narrow string literals. The behavior is undefined in this case. However, it is likely that the programmer's intention was to create a wide string literal.
Code Block | ||
---|---|---|
| ||
wchar_t *msg = L"This message is very long, so I want to divide it " "into two parts."; |
...
If the concatenated string needs to be a wide string literal, each element in the concatenation has to must be a wide string literal.
...
Code Block | ||
---|---|---|
| ||
char * msg = "This message is very long, so I want to divide it " "into two parts."; |
...