![]() |
![]() |
0337 | ![]() |
||||
![]() | |||||||
| 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\\); /* */
MISRA C:2012 Rules applicable to message 0337:
| 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 |