P
Peter Kirk
Hi there
I have a question about static variables. There is a function which returns
a pointer to a structure "AStructure". The function has a static local
variable of type AStructure, and it is the address of this variable which is
returned. Is this good practice?
See this pseudo code:
AStructure *my_function()
{
static AStructure result;
// "result" is filled with data...
return ( &result );
}
Thanks,
Peter
I have a question about static variables. There is a function which returns
a pointer to a structure "AStructure". The function has a static local
variable of type AStructure, and it is the address of this variable which is
returned. Is this good practice?
See this pseudo code:
AStructure *my_function()
{
static AStructure result;
// "result" is filled with data...
return ( &result );
}
Thanks,
Peter