View Single Post
  #1  
Old 08-19-2005, 06:36
Cobi Cobi is offline
Friend
 
Join Date: Sep 2004
Location: Germany
Posts: 55
Rept. Given: 0
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 0
Thanks Rcvd at 1 Time in 1 Post
Cobi Reputation: 0
sizeof() returns "wrong" Size of structure

Why is this structure 20 Bytes in size?
Code:
typedef	struct STGAHeader{

	BYTE	m_uIDSize;
	BYTE	m_uColorMapType;
	BYTE	m_uImageType;

	short	m_sColorMapStart;
	short	m_sColorMapLength;
	BYTE	m_uColorMapBits;

	short	m_sXStart;
	short	m_sYStart;
	short	m_sWidth;
	short	m_sHeight;
	BYTE	m_uBits;
	BYTE	m_uDescriptor;

} STGAHeader;
(BYTE = unsigned char = 1 byte, short = 2 bytes)
For me 1+1+1+2+2+1+2+2+2+2+1+1 is 18 and not 20 but the compiler thinks different
Its absolutely impossible that 6*integer1+6*integer2 is equal 20
(Intel 8.0 win)
thx, Cobi

Last edited by Cobi; 08-19-2005 at 06:39.
Reply With Quote