>       struct foo *fee;
> It's possible that:
>       sizeof(struct foo) != (((char *)&fee[1]) - ((char *)&fee[0]))
> because of end-padding, which is not accounted for in arrays,

Er, no, that's not right.  Otherwise 

  fee = malloc(n * sizeof(struct foo))

wouldn't work.

C89 says:

  There may also be unnamed padding at the end of a structure or union,
  as necessary to achieve the proper alignment were the structure or
  union to be an element of an array.


  the result [of sizeof] is the total number of bytes in such an object,
  including internal and trailing padding.

So if a struct needs padding in an array, it has it even when it isn't
in an array.

-- Richard

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to