![]() |
![]() |
3501 | ![]() |
||||
![]() | |||||||
| Readability | |||||||
An assignment operator (=) is followed by a unary operator without an intervening space. In old (pre-ISO) versions of the C language, compound assignment operators were written differently. For example, the compound addition operator was "=+" instead of "+=". These old forms are no longer valid syntax in ISO:C; but it can be misleading if a simple assignment operator (=) is followed by a unary operator such as (*, +, - or &) with no intervening space. Addition of a space has no semantic significance but may eliminate confusion. Message 3501 is generated to identify such situations. For example:
/*PRQA S 506,2211,3120,3198,3199,3203,3227,3408,3440,3447,3600,3673 ++*/
extern void foo(int sia)
{
int si;
int *pi;
si=-10; /* Message 3501 */
si=+10; /* Message 3501 */
pi=&sia; /* Message 3501 */
si=*pi; /* Message 3501 */
si=- 10; /* Message 3501 */
si=+ 10; /* Message 3501 */
pi=& sia; /* Message 3501 */
si=* pi; /* Message 3501 */
si= -10; /* */
si= +10; /* */
pi= &sia; /* */
si= *pi; /* */
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |