![]() |
![]() |
3123 | ![]() |
||||
![]() | |||||||
| Constants | |||||||
A character constant has been used. It may be better to define the constant as a macro, an enum constant or a "const" qualified object. Message 3123 will not be generated in these contexts and the definition can be located where it can more easily be reviewed and maintained - rather than buried within executable code. This is particularly important for maintainability if the same constant is reused in several places. Giving the constant a name may also improve readability. This message will not be generated for the null character constant '\0' because it is so commonly used in initializations, For example:
/*PRQA S 2017,2213,3198,3199,3203,3218,3408,3602,3625 ++*/
#define FLAG 'X'
enum {EFC = 'X'};
static const char flag = 'X';
extern void foo( void )
{
char pc;
pc = 'X'; /* Message 3123 */
pc = FLAG; /* */
pc = EFC; /* */
pc = flag; /* */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |