[previous] 0337 [next] [U] String literal has undefined value. This may be a result of using '#' on \\.
Explicitly undefined REFERENCE - ISO:C90-6.8.3.2 The # Operator - Semantics

The string literal constructed by this macro is malformed because it is not bounded by double quotes.

This can happen when the # operator in a macro is applied to an argument which is terminated with a backslash (\). # constructs a string literal by surrounding its operand (i.e. the macro argument) with double quotes. If the argument token ends with a backslash, the backslash character has the effect of escaping the second double quote and leaving an unfinished string literal. This problem can be avoided if the macro argument is terminated instead with a double backslash (\\).

For example:


/*PRQA S 2017,3122,3211,3408,3429,3625,3674 ++*/

#define STR(x) #x

char buf1[] = STR(ABC\);                 /* Message 0337 */
char buf2[] = STR(ABC\\);                /*              */

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents