[previous] 0473 [next] [Q] Result of 'sizeof' operation will not fit in configured type for 'size_t'.
QAC configuration REFERENCE - ISO:C90-6.3.3.4 The sizeof Operator, ISO:C90-7.1.5 Common Definitions <stddef.h>

The result of this sizeof operation is a value that is too large to be represented in type size_t. It may be that a mistake has been made in configuring QA·C.

The sizeof operator returns the size (in bytes) of its operand. The operand may be an expression or the parenthesized name of a type. The size is determined from the type of the operand and is represented in the type size_t.

size_t is always an unsigned type but its actual type is implementation-defined. The implemented type can be configured in QA·C with the -IntrinsicType option (compiler personality).

For example:


/*PRQA S 612,702,1278,3132,3198,3199,3203,3408,3625 ++ */
/*************************************/
/* OPTIONS: -s int=16                */
/*          -it size_t=unsigned int  */
/*************************************/
char cb1[65535L];
char cb2[65536L];


void func(void)
{
  unsigned long asz;

  asz = sizeof(cb1);            /* OK           */
  asz = sizeof(cb2);            /* Message 0473 */
}

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