Mail Archives: djgpp/2001/06/18/03:00:11
From: | Jack Klein <jackklein AT spamcop DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: BIG problem with structure alignment!
|
Message-ID: | <6j8ritgiss20bunpjt7fhdv0vskb3va575@4ax.com>
|
References: | <001101c0f7a6$837b46a0$cf10a2cb AT lunar>
|
X-Newsreader: | Forte Agent 1.8/32.548
|
MIME-Version: | 1.0
|
Lines: | 66
|
Date: | Mon, 18 Jun 2001 06:45:25 GMT
|
NNTP-Posting-Host: | 12.84.8.100
|
X-Complaints-To: | abuse AT worldnet DOT att DOT net
|
X-Trace: | bgtnsc04-news.ops.worldnet.att.net 992846725 12.84.8.100 (Mon, 18 Jun 2001 06:45:25 GMT)
|
NNTP-Posting-Date: | Mon, 18 Jun 2001 06:45:25 GMT
|
Organization: | AT&T Worldnet
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
On Mon, 18 Jun 2001 10:22:27 +0700, "Lunar" <lunarorb AT hn DOT vnn DOT vn> wrote
in comp.os.msdos.djgpp:
> This is a multi-part message in MIME format.
Please don't do this. Usenet discussion groups are text only. Find
the Outlook Express options for posting to newsgroups and set it to
text only.
> ------=_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
Asking for private email responses in technical discussion groups is
considered rude.
> 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 =
Both the C and C++ languages allow the compiler to add padding between
the members of a structure and after the last member for alignment
purposes. The only place that padding is not allowed is in front of
the first member of the structure.
Why do you have a problem with this? DJGPP programs can access many
megabytes of data, do you have that many of these structures?
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
- Raw text -