| www.delorie.com/archives/browse.cgi | search |
| Resent-Message-Id: | <199603181506 DOT KAA05147 AT delorie DOT com> |
| Message-Id: | <199603181506.KAA05147@delorie.com> |
| Resent-Date: | Mon, 18 Mar 96 17:06:22 LIT |
| Resent-From: | Martynas Kunigelis <martynas DOT kunigelis AT VM DOT KTU DOT LT> |
| Resent-To: | DJGPP mailing list <djgpp AT delorie DOT com> |
| Date: | Mon, 18 Mar 96 14:34:33 LIT |
| From: | Martynas Kunigelis <martynas DOT kunigelis AT VM DOT KTU DOT LT> |
| Subject: | Re: Packed Align bug in G++ 2.7.2?? |
| To: | DJGPP mailing list <djpp AT delorie DOT com> |
| In-Reply-To: | Your message of 14 Mar 1996 18:26:33 GMT |
To correct the buggy G++ 2.7.2 behaviour when packing structures, use:
#pragma pack(1) /* align by 1 byte boundary */
struct my_struct {
short a;
char b; /* offset 2 */
int b; /* offset 3 */
};
#pragma pack() /* restore default alignment */
if the structure is defined in a header file, do:
#pragma pack(1)
#include <header.h>
#pragma pack()
..hope this helps.
Martynas Kunigelis
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |