www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/18/13:07:46

Date: Sun, 18 Aug 1996 19:02:20 +0200
Message-Id: <199608181702.AA28727@mail.umu.se>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
From: hubble AT hem DOT passagen DOT se (Andreas Vernersson)
Subject: What am i doing wrong?

Could anyone explain this?

typedef struct a
{	unsigned int q2 __attribute__((packed));
	unsigned char qq __attribute__((packed));
} b;

typedef struct a2
{	
	unsigned int q2;
	unsigned char qq;
} b2;


void main()
{
	printf("size: %d\n",(int)sizeof(b));  // 5 ???
	printf("size: %d\n",(int)sizeof(b2));  // 8  ???
}


----
I only wants the datastructure to be 2+1=3 bytes... 

- Raw text -


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