Why is this an issue?
Concatenation of wide and narrow string literals has not always been supported in C or C++, and even when supported, the meaning may be unclear to
the reader. Concatenation of string literals with different encodings is only conditionally supported, and may be removed in a future version of the
Therefore, only string literals with the same prefix should be concatenated together.
Noncompliant code example
wchar_t n_array = "Hello" L"World"; // Noncompliant
wchar_t w_array = L"Hello" "World"; // Noncompliant
char_t n_array = "Hello" "World"; // Compliant
wchar_t w_array = L"Hello" L"World"; // Compliant
- MISRA C++:2008, 2-13-5 - Narrow and wide string literals shall not be concatenated.
- CERT STR10-C. - Do not concatenate different type of string literals