Article View: gnu.gcc.help
Article #42328Re: q: structrue packing
From: Kazimir Kylheku
Date: Tue, 12 Dec 1995 00:00
Date: Tue, 12 Dec 1995 00:00
22 lines
1099 bytes
1099 bytes
In article <30c84575.17614502@news.toplink.de>,
Friedemann Baitinger <baiti@herrenberg.netsurf.de> wrote:
>how can i instruct the gcc compiler to generate packed structures?
>
>#define BYTE1 unsigned char
>#define BYTE2 unsigned short
>#define BYTE4 unsigned long
>
>typedef struct {
> BYTE2 b21;
> BYTE2 b22;
> BYTE2 b23;
> BYTE4 b41;
>} some_t;
>
>in this example, i always get a two byte gap between b23 and b41.
>sizeof(some_t) evaluates to 12 instead of 10.
Did you read the man page? Try -mno-strict-align, it might do the trick.
--
I got my degree from the U of NIX.
Better dead than Redmond.
Technical Details
Message-ID:
<4ak7mbINNfrc@keats.ugrad.cs.ubc.ca>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<30c84575.17614502@news.toplink.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,4ec01187e2d9ea4e X-Google-Attributes: gid11318c,public From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) Subject: Re: q: structrue packing Date: 1995/12/12 Message-ID: <4ak7mbINNfrc@keats.ugrad.cs.ubc.ca> X-Deja-AN: 121757930 references: <30c84575.17614502@news.toplink.de> organization: Computer Science, University of B.C., Vancouver, B.C., Canada newsgroups: gnu.gcc.help