![]() |
![]() |
3216 | ![]() |
||||
![]() | |||||||
| Pointers | |||||||
The address of a local object with static storage duration is being assigned to a pointer which has linkage or wider scope. The object can therefore no longer be considered 'private' to this function. Is this intended ? Perhaps it should be declared at file scope with linkage ? For example:
/*PRQA S 506,2017,3122,3223,3227,3408,3447,3625,3674 ++*/
extern char *pc;
extern void f1(void)
{
static char buf[] = "Diagnostic message:";
pc = &buf[0]; /* Message 3216 */
}
extern void f2(int **appi)
{
static int bi = 1;
*appi = &bi; /* Message 3231 */
}
extern int * f3(void)
{
static int a;
return &a; /* Message 4139 */
}
No MISRA C:2012 Rules applicable to message 3216
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |