On Tue, Jan 4, 2011 at 1:07 PM, Rajesh S R <srrajesh1989@gmail.com> wrote:
On Tue, Jan 4, 2011 at 11:28 PM, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote:
On Wed, Jan 5, 2011 at 00:40, mohit verma <mohit89mlnc@gmail.com> wrote:
hi all, i have seen many places in kernel where the variables specially the structures should be of fixed size independent of the architecture. i went through the definitions of them but dint get clearly (or frankly say ...dint get them even a bit) .
Your question isn't specific enough, so I'll just guess. Let's say "int". In 32 bit, AFAIK it's 4 byte, but in 64 bit (like IA 64, not sure if it's x64) it's 8 byte. So, if you just say "int", you will likely getting screwed up.
By using types like u_int or something like that, you pretty much say "I mean 4 byte kind of integer" etc
Still there can be padding issues due to byte alignment, which may vary across architecture. Am not sure if that is controllable (probably some pragma to gcc?). Probably, OP is asking about it?
I believe you are referring to __attribute__( ( packed ) )