Re: Some static about static



Thanks for posting.

What's "packed"? It's not a C or C++ keyword. Is it a macro? If so, what
does it expand to?

We use it to jam data together in structs where elements would
otherwise fall on native size boundaries. It is useful to me when
moving data between pipes/queues and structs. For instance when
pulling data from a pipe I just give it the address of the packed
struct. If the struct were not packed I would need to use memcpy to
copy it into a struct piecewise instead of loading it directly from
the pipe. Saves some time and memory in my embedded system. It is
apparently supported by many compilers:

http://en.wikipedia.org/wiki/Data_structure_alignment

   static faultMsgType faultMsg;

did not make it static, meaning it was still on the stack.

How do you determine this?


The struct is quite large and it caused the calling task to overflow
its stack allotment. Then I verified it by looking at memory with a
debugger.

This is not valid C, and shouldn't compile. What compiler are you using?


Mentor Graphics Microtek compiler. Apparently it has sufficient
thrust....


thanks,

jh
.



Relevant Pages