goodTweetieBird
2009-09-02 17:22:11 UTC
I have the following struct in a C, not C++ program.
typedef packed struct
{
header_struct header;
fault_struct fault;
} faultMsgType;
It seems the use of static is different with typedefs than with built-
in types. I like to use typedefs for a number of reasons: I can put
them in headers and it makes the predictive typing work better in
slickEdit, etc. I wanted the make a variable of this type static in a
particular function as the function was called by a built in OS timer
task which seems to have a small stack. However,
static faultMsgType faultMsg;
did not make it static, meaning it was still on the stack. But this
did:
faultMsgType static faultMsg;
Is this proper compiler behavior?
Thanks,
jh
typedef packed struct
{
header_struct header;
fault_struct fault;
} faultMsgType;
It seems the use of static is different with typedefs than with built-
in types. I like to use typedefs for a number of reasons: I can put
them in headers and it makes the predictive typing work better in
slickEdit, etc. I wanted the make a variable of this type static in a
particular function as the function was called by a built in OS timer
task which seems to have a small stack. However,
static faultMsgType faultMsg;
did not make it static, meaning it was still on the stack. But this
did:
faultMsgType static faultMsg;
Is this proper compiler behavior?
Thanks,
jh