🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42434

q: structrue packing

#42434
From: Friedemann Baitinger
Date: Fri, 08 Dec 1995 00:00
18 lines
879 bytes
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.
---

Friedemann M. Baitinger                 email: baiti@herrenberg.netsurf.de
Technical Details
Message-ID: <30c84575.17614502@news.toplink.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,4ec01187e2d9ea4e,start
X-Google-Attributes: gid11318c,public
From: baiti@herrenberg.netsurf.de (Friedemann Baitinger)
Subject: q: structrue packing
Date: 1995/12/08
Message-ID: <30c84575.17614502@news.toplink.de>
X-Deja-AN: 121389199
organization: TopLink GbR, Germany, Internet Services
reply-to: baiti@herrenberg.netsurf.de
newsgroups: gnu.gcc.help