![]() |
![]() |
0682 | ![]() |
||||
![]() | |||||||
| Constraint violations | REFERENCE - ISO:C90-6.5.7 Initialization - Semantics, ISO:C90-6.3.16.1 Simple Assignment - Constraints | ||||||
This is a constraint error An object of type 'char', 'signed char', 'unsigned char' or 'wchar_t' is being initialized with a string literal. A string literal has type 'array of char' and can only be used to initialise an object of compatible pointer type or array type. An object of type 'char' can only be initialised with an integral constant expression, for example a character constant. For example:
/*PRQA S 753,2017,2211,3122,3132,3205,3408,3604,3625 ++*/
extern void foo(void)
{
char h1 = "Y"; /* Message 0682 */
char h2 = "hello\n"; /* Message 0682 */
char buf[2] = "Y"; /* OK */
char *pc = "hello\n"; /* OK */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |