![]() |
![]() |
3217 | ![]() |
||||
![]() | |||||||
| Pointers | REFERENCE - ISO:C90-6.1.2.4 Storage Durations of Objects | ||||||
The address of an automatic object has been assigned to a pointer which has linkage or wider scope. This is dangerous. When the local object goes out of scope, the value obtained by dereferencing the pointer will be undefined. Perhaps this object needs to be declared with static storage duration ? For example:
/*PRQA S 2017,3408,3447 ++*/
extern int* pi;
void foo(void)
{
int a;
pi = &a; /* Message 3217 */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |