> Normally we will have the following sizes: > sizeof(a.msg) = 14 > sizeof(a.NAMEDFIELD.error) = 1 > sizeof(a.NAMEDFIELD.entete) = 4 > sizeof(a.lNAMEDFIELD.en) = 1 > sizeof(a.NAMEDFIELD.data) = 8. > So we can think that sizeof(a.msg)=sizeof(a.NAMEDFIELD) No, structure layout doesn't work like that. > but sizeof(a.NAMEDFIELD)=20 ... Yes, it follows the ABI rules: 'long' are aligned on n-byte boundaries, the size of the structure must be a multiple of the alignment and so on. > How can this problem can be resolved? Put __attribute__((packed)) on the structure. -- Eric Botcazou