From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,27231e56b1afd21f X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-12-07 20:52:40 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!paladin.american.edu!newsfeed.ACO.net!swidir.switch.ch!epflnews!monnier From: "Stefan Monnier" Newsgroups: comp.unix.osf.osf1 Subject: Re: Funny alignment with structures ? Date: 7 Dec 1994 14:50:43 GMT Organization: Ecole Polytechnique Federale de Lausanne Message-ID: <3c4i43$mjk@info.epfl.ch> References: NNTP-Posting-Host: didec11.epfl.ch Originator: monnier@didec11.epfl.ch In article , Anthony wrote: ] I thought the alignment would be like this: ] ] 16bits 16bits 16bits 16bits ] _______________________________________________________________ ] |major v|minor v| flags | entry_size | entry_count | ] ---------------------------------------------------------------- ] | next_entry | start_par | end_par | next_par | ] ---------------------------------------------------------------- ] | next_offset | seqno | updates | ] ---------------------------------------------------------------- ] .......... here, seqno is not on a 32bit boundary. It's hence incorrectly aligned. ] but I am getting this alignment ] ] 16bits 16bits 16bits 16bits ] _______________________________________________________________ ] |major v|minor v| flags | entry_size | entry_count | ] ---------------------------------------------------------------- ] | next_entry | start_par | end_par | next_par | ] ---------------------------------------------------------------- ] | next_offset | not used | ] ---------------------------------------------------------------- ] | seqno | updates | ....... ] -------------------------------------------------- ] .......... That's a surprise, I would expect: | next_offset | not used | seqno | Since this is sufficient for seqno to be 32bits aligned. Are you sure of the alignment you suggested ? Anyway, you can't really avoid it. Either you move things around so that the compiler doesn't have to insert blanks, or you split the seqno field into two 16bits fields. Unless there's a magic compiler option, but that would be a surprise ! Stefan -- -------------------------------------------------------------------- -- Suicidez-vous jeune, vous profiterez plus longtemps de la mort -- --------------------------------------------------------------------