[previous] 0550 [next] [C] Left operand of '+=' or '-=' is a pointer to an object of unknown size.
Constraint violations REFERENCE - ISO:C90-6.3.16.2 Compound Assignment - Constraints

This is a constraint error

When performing any kind of pointer arithmetic, it is always necessary to know the size of the object being addressed. For example, when adding "1" to a pointer, the value of the pointer is not incremented by 1 byte but by the size (in bytes) of the type being addressed. For this reason, a pointer to an incomplete type cannot be the operand of an addition or subtraction.

For example:


/*PRQA S 488,510,3227,3313,3408,3447 ++*/

extern struct ST *ps;
extern void *pv;

void foo(int n)
{
   ps += n;       /* Message 550 */
   ps -= n;       /* Message 550 */

   pv += n;       /* Message 550 */
   pv -= n;       /* Message 550 */
}

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents