www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/30/00:45:57

From: "Victoria Bradburne" <victoria AT browns DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Help: Packing structures
Date: Wed, 29 Jan 1997 17:48:49 GMT
Organization: Browns
Message-ID: <01bc0e37$b83989e0$1293d9c2@victoria.browns.co.uk>
NNTP-Posting-Host: w18.browns.co.uk
Lines: 18
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Please could someone help my in packing a data structure. I  am using DJGPP
as a cross compiler to M68000 and am having trouble packing some data
structures:

struct Packet {
	Byte ID;
	Word Length;
	Byte Data[DATALEN];
};

The above structure is usually expanded into:
	Byte ID, spare Byte, Word Length, Data array......

I wanted to lose the spare Byte which is used to word align the Length
variable.  I tried defining a variable with __attribute__ ((packed)) and
although this changed the assembler code it still left the spare byte. 
What am I doing wrong?

- Raw text -


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