[previous] 0874 [next] [U] Character string literal and wide character string literal are adjacent.
Explicitly undefined REFERENCE - ISO:C90-6.1.4 String Literals - Semantics

An ordinary string literal is immediately adjacent to a wide string literal. The C language will automatically concatenate 2 adjacent string literals or 2 adjacent wide string literals; but it is not possible to mix the two. Behaviour will be undefined.

For example:


/*PRQA S 753,878,2017,3211,3408,3410,3429,3453,3625 ++*/

#include <stddef.h>

#define HN "Hello"
#define WN " World.\n"

#define HW L"Hello"
#define WW L" World.\n"

char    * t1 = HN WN;
char    * t2 = HN WW;                    /* Message 0874 */
wchar_t * t3 = HW WW;


MISRA C:2012 Rules applicable to message 0874:

Rule-1.3  (Required) There shall be no occurrence of undefined or critical unspecified behaviour


QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents