delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/11/19/16:00:16

From: scottc AT net-community DOT com (Scott Christley)
Subject: Re: one point (Was [Re: FW: Re: wxwin port])
19 Nov 1996 16:00:16 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199611191609.IAA01747.cygnus.gnu-win32@stetson.net-community.com>
Mime-Version: 1.0
X-Sender: scottc AT net-community DOT com
X-Mailer: Windows Eudora Light Version 1.5.2
Original-To: Doug Evans <dje AT cygnus DOT com>
Original-Cc: garp AT opustel DOT com, gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

At 05:08 PM 11/18/96 -0800, Doug Evans wrote:
>
>I don't believe this assessment can be correct.
>If GCC doesn't align structures [by default] the way the native compiler does,
>then that is a bug, end of story.
>

It appears that the Microsoft header file is forcing the packing of the
structure.  Before it defines the structure it includes in a file called
"pshpack2.h" which I've included below:

/*++

Copyright (c) 1995-1996  Microsoft Corporation

Module Name:

    pshpack2.h

Abstract:

    This file turns 2 byte packing of structures on.  (That is, it disables
    automatic alignment of structure fields.)  An include file is needed
    because various compilers do this in different ways.  For Microsoft
    compatible compilers, this files uses the push option to the pack pragma
    so that the poppack.h include file can restore the previous packing
    reliably.

    The file poppack.h is the complement to this file.

--*/

#if ! (defined(lint) || defined(_lint) || defined(RC_INVOKED))
#if ( _MSC_VER >= 800 ) || defined(_PUSHPOP_SUPPORTED)
#pragma warning(disable:4103)
#if !(defined( MIDL_PASS )) || defined( __midl )
#pragma pack(push)
#endif
#pragma pack(2)
#else
#pragma pack(2)
#endif
#endif // ! (defined(lint) || defined(_lint) || defined(RC_INVOKED))

******

So my question at this point is does GCC support this pushing of pack, or am
I correct in using __attribute__ ((packed)) where appropriate?

So to adjust my assessment, GCC is aligning structures the same way as the
native compiler; the packing behaviour was changed for that structure within
the include files.

Scott

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019