Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!um-math!sharkey!shadooby!accuvax.nwu.edu!tank!ncar!unmvax!pprg.unm.edu!hc!lll-winken!uunet!mcvax!kth!sunic!front.se!zap From: zap@front.se (Svante Lindahl) Newsgroups: comp.lang.c Subject: Structure padding Message-ID: <440@front.se> Date: 6 Apr 89 11:14:48 GMT Organization: Front Capital Systems, Stockholm, Sweden Lines: 23 Consider a struct consisting of a few character arrays, for example: stuct foo { char bar[3]; char baz[6]; char frotz[4]; } fred; I need to know if I can safely assume that there will not be any padding between the arrays. I didn't think that this would be OK to assume, but I've tried this with a few different machine and compiler combos (Sun3/SunOS3.5+(cc|gcc), Sun4/SunOS4.0+cc, Pyramid9820/ OSx4.1+cc (%)) and none of them place any padding between the arrays. -- % Pyramid's cc is not based on pcc. (Note: I'm not talking about padding at the end of the struct; there will often be padding after the last array to make the size of the struct be a multiple of 2 or 4 bytes.) -- Svante.Lindahl@front.se (path-net: uunet!front.se!svante) (non-mx: Svante.Lindahl%front.se@uunet.uu.net)