From: Steven Jenkins Date: 2003-09-11T12:26:08+09:00 Subject: Re: Calling fun taking struct and not pointer to struct? Tim Hunter wrote: > A compiler is free to align a structure on a boundary that is stricter > than that required by its members. For example, a structure with an int as > its first member may be aligned on a dword boundary, if that makes it > easier to generate code for accessing the structure elements. (Consider > the needs of arrays of structures allocated from the heap.) Correct. ISO C further guarantees that a pointer to a structure may be coerced to a pointer to its first element. > Also a compiler is free to add padding between structure elements as it > sees fit. Correct. By the above guarantee, no padding can occur before the first element. > For "something in writing" check the ANSI standard. For the pedantically-inclined, ISO/IEC 9899. But K&R 2nd edition deals with this adequately in Appendix A. Steve