Re: offsets of fields in a structure
Glynn Clements <[email protected]>
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
Giulio Rossato wrote: > I want write a function that receives as parameters a start address and > a "description of a structure" and returns the offsets of the fields. > The structure is not known at compile time. The offsets should be > calculated at runtime and the code should be independent of the machine. > How should be written this function? Your code will need to express the rules which the compiler uses to lay out structures; there is no mechanism to obtain this information from the compiler. -- Glynn Clements <[email protected]>