According to MISRA 2008, concatenation of wide and narrow string literals leads to undefined behavior. This is an implicit undefined behavior according to C99 to the C standard [ISO/IEC 9899:19992011].
Noncompliant Code Example
...
Code Block |
---|
|
wchar_t *msg = L"This message is very long, so I want to divide it "
"into two parts.";
|
...
Code Block |
---|
|
wchar_t *msg = L"This message is very long, so I want to divide it "
L"into two parts.";
|
...
Code Block |
---|
|
char *msg = "This message is very long, so I want to divide it "
"into two parts.";
|
...