Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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
bgColor#ffcccc
langc

wchar_t *msg = L"This message is very long, so I want to divide it "
                "into two parts.";

...

Code Block
bgColor#ccccff
langc

wchar_t *msg = L"This message is very long, so I want to divide it "
               L"into two parts.";

...

Code Block
bgColor#ccccff
langc

char *msg = "This message is very long, so I want to divide it "
            "into two parts.";

...