![]() |
![]() |
0309 | ![]() |
||||
![]() | |||||||
| Explicitly undefined | REFERENCE - ISO:C90-6.3.4 Cast Operators - Semantics | ||||||
A pointer is being cast to an integral type but the type is too small to represent the value. Perhaps it is necessary to use a larger integral type but this may simply be a problem which can be resolved by reconfiguring QA·C. The size of pointer types as well as object types can be configured using the -size (-s) option (compiler personality). By default, pointers to objects and pointers to functions are assumed to be represented in 32 bits. Under this configuration, message 0309 will be generated if a pointer is cast to an integral type which is configured in less than 32 bits. For example:
/*PRQA S 306,2017,3198,3199,3203,3205,3227,3408,3673 ++*/
extern void foo(int *pi)
{
unsigned char uc;
unsigned short us;
unsigned int ui;
unsigned long ul;
uc = (unsigned char )pi; /* Message 0309 */
us = (unsigned short)pi; /* Message 0309 */
ui = (unsigned int )pi; /* */
ul = (unsigned long )pi; /* */
}
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |