Mail Archives: djgpp/2001/06/17/23:30:30
Message-ID: | <001101c0f7a6$837b46a0$cf10a2cb@lunar>
|
From: | "Lunar" <lunarorb AT hn DOT vnn DOT vn>
|
To: | <djgpp AT delorie DOT com>
|
Subject: | BIG problem with structure alignment!
|
Date: | Mon, 18 Jun 2001 10:22:27 +0700
|
MIME-Version: | 1.0
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Mailer: | Microsoft Outlook Express 5.00.2615.200
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2615.200
|
Reply-To: | djgpp AT delorie DOT com
|
This is a multi-part message in MIME format.
------=_NextPart_000_000D_01C0F7E0.92BD7A40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi you all,
I've met this problem with structure declaration:
I did have a struct like this:
struct T1{
char _t1;
short _t2;
};
and the sizeof(T1) return a result of 4, instead of 3 as I expected. Why =
is that? If it's because of some aligment option, then could you help me =
turn them off?
Please mail me at lunarorb AT hn DOT vnn DOT vn if you can help
Thanks
Lunar
------=_NextPart_000_000D_01C0F7E0.92BD7A40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi you all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I've met this problem with structure=20
declaration:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I did have a struct like =
this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>struct T1{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> char _t1;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> short _t2;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>};</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>and the sizeof(T1) return a result of =
4, instead of=20
3 as I expected. Why is that? If it's because of some aligment option, =
then=20
could you help me turn them off?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Please mail me at <A=20
href=3D"mailto:lunarorb AT hn DOT vnn DOT vn">lunarorb AT hn DOT vnn DOT vn</A> if you can=20
help</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Lunar</FONT></DIV></BODY></HTML>
------=_NextPart_000_000D_01C0F7E0.92BD7A40--
- Raw text -