Groups | Search | Server Info | Login | Register
Groups > comp.lang.c.moderated > #411
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c.moderated |
| Subject | Re: distributing data across a structure (new to c please help) |
| Date | 2012-08-20 22:10 -0500 |
| Organization | None to speak of |
| Message-ID | <clcm-20120820-0002@plethora.net> (permalink) |
| References | <clcm-20120809-0001@plethora.net> <clcm-20120820-0001@plethora.net> |
Dennis Yurichev <dennis_mailing_lists@conus.info> writes:
[...]
> Also, do not forget about C compiler may align all struct members by 4
> bytes on x86 and 8 bytes on Win64.
> Since Windows PE file fields are all differently sized and this is very
> important, please consult "pack" pragma:
> http://msdn.microsoft.com/en-us/library/2e70t5y1(v=vs.80).aspx
A compiler is unlikely to align *all* struct members on 4-byte or 8-byte
boundaries. For example, given:
struct foo {
char x;
char y;
};
I'd expect offsetof(struct foo, y) to be 1 and sizeof (struct foo) to be
2 for most compilers.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
Back to comp.lang.c.moderated | Previous | Next — Previous in thread | Next in thread | Find similar
distributing data across a structure (new to c please help) nwdpil <mkeput@gmail.com> - 2012-08-09 20:32 -0500
Re: distributing data across a structure (new to c please help) James Kuyper <jameskuyper@verizon.net> - 2012-08-10 00:43 -0500
Re: distributing data across a structure (new to c please help) Dennis Yurichev <dennis_mailing_lists@conus.info> - 2012-08-20 14:17 -0500
Re: distributing data across a structure (new to c please help) Keith Thompson <kst-u@mib.org> - 2012-08-20 22:10 -0500
Re: distributing data across a structure (new to c please help) Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-08-20 22:11 -0500
csiph-web