![]() |
![]() |
3627 | ![]() |
||||
![]() | |||||||
| Constants | |||||||
This string literal includes a single-quote character (") - an apostrophe. An escape sequence representation may be preferred. When a single-quote character is required in a character constant, it must be represented using an escape sequence (\'); but this isn't essential in a string literal. Similarly, when a double-quote character is to be represented in a string literal, it must be represented using an escape sequence (\"); but this isn't necessary in a character constant. Some coding standards recommend that, for consistency, all single-quotes and double-quotes should be coded using escape sequences whether they occur in character constants or string literals. For example:
/*PRQA S 2017,3123,3211,3408,3602,3625 ++*/
char pca = '"'; /* Message 3626 */
char pcb = '\"'; /* */
char pcc = '\''; /* */
const char * psa = "an apostrophe: '"; /* Message 3627 */
const char * psb = "an apostrophe: \'"; /* */
const char * psc = "a quotation mark: \""; /* */
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |