Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com X-Authentication-Warning: modi.xraylith.wisc.edu: khan owned process doing -bs Date: Tue, 4 May 1999 13:22:43 -0500 (CDT) From: Mumit Khan Reply-To: Mumit Khan To: DJ Delorie cc: anorland AT hem2 DOT passagen DOT se, cygwin-developers AT sourceware DOT cygnus DOT com, corinna DOT vinschen AT cityweb DOT de, cgf AT cygnus DOT com Subject: Re: Patch, Version 4: Problem solved In-Reply-To: <199905041745.NAA24026@envy.delorie.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 4 May 1999, DJ Delorie wrote: > The alignment of A changes from 4 bytes (sizeof(int)) to 8 bytes > (sizeof(double)), so the alignment of B (which contains A) must also > change from 4 to 8. The size of B is increased to a multiple of the > alignment so that each element of an array of such objects is properly > aligned. IMHO, this is correct and expected behavior. Exactly. > If MS wants them "less aligned" you'll have to use gcc's alignment > directives to reduce the alignment of that double to 4. MS and GNU do agree on this for a change! The bug is elsewhere since as far as I can tell, MS and GNU are doing exactly the same thing (I did try out Anders' code posted to egcs-bugs, and get the same result, as expected in this particular case, from MSVC 5.0 and EGCS-1.1.2). Anders, are you sure the code for the particular structure is in the right packing mode (I believe it should pack(4) for LUID_AND_ATTRIBUTES)? I get the same: B: 12 .a: 8, 0 .i: 4, 8 and, B: 16 .a: 8, 0 .i: 4, 8 I also checked the code using `#pragma pack(4)', and get the same result from both compilers. Here I get: B: 12 .a: 8, 0 .i: 4, 8 and, B: 12 <<< NOTE it's back to 12 for both compilers as expected. .a: 8, 0 .i: 4, 8 Regards, Mumit