![]() |
![]() |
4139 | ![]() |
||||
![]() | |||||||
| Pointers | |||||||
The address of a local object with static storage duration is being exported to a wider scope through the function return expression. 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 */
}
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |