Sorry. I poor english.
I defined follow and some struct created.
My problem is size.
Indivisual size(BYTE, WORD, DWORD) is correct (1 ,2 ,4);
But struct size is incorrect.
//=================================================
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef _date {
WORD y; /* year */
BYTE m; /* month */
BYTE d; /* day */
BYTE w; /* week */
}Date;
qWarning("BYTE %d WORD %d DWORD%d\n"
,sizeof(BYTE),sizeof(WORD),sizeof(DWORD));
qWarning("Date size is %ld \n", sizeof(Date));
//===================================================
Result is
"BYTE 1 WORD 2 DWORD 4
Date size is 6 "
Why this problem occurs?
Correct result "Date size is 5", is right???
My works network protocol create and send and rceived.
So I create some date and rearrange.
So data size is important.
I'm using Qt 3.3.2 and running Gentoo Linux.