www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/03/20:52:15

Xref: news2.mv.net comp.os.msdos.djgpp:761
From: Shawn Hargreaves <slh100 AT york DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: __alignement__ in v2b5
Date: Sat, 3 Feb 1996 13:22:41 +0000
Organization: The University of York, UK
Lines: 18
Message-ID: <Pine.SGI.3.91.960203132111.8466A-100000@tower.york.ac.uk>
References: <4etntt$75b0 AT news DOT i-link DOT net>
NNTP-Posting-Host: tower.york.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> struct TestStruct
>   {
>   char var1;
>   short var2  __attribute__ ((packed));
>   };
> 
> Can anyone tell me why this program produces:
> 
> sizeof(TestStruct): 4

You specified that the short (var2) is packed, but didn't say anything 
about the char var1. I would imagine that giving both fields the packed 
attribute would produce the expected size of 3.


Shawn Hargreaves                        If God is omnipotent, can he make a
http://www.york.ac.uk/~slh100/          rock so heavy that he cannot lift it?

- Raw text -


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