Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: Performance of unaligned memory-accesses Date: Mon, 12 Aug 2019 09:33:59 -0700 Organization: None to speak of Lines: 24 Message-ID: References: <7ba21901-827f-4116-93a1-ae698e4c3208@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="2f44d05b13bc2f3f5103065553a9c589"; logging-data="19665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18F/3OuJBfTsM/w4n8234jf" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:lcpU0zkqmjFrDnWjCNqk5GhQbSg= sha1:s9pzZV6zckhMkoWHkJTJnJCnoI4= Xref: csiph.com comp.lang.c++:67603 Öö Tiib writes: > On Monday, 12 August 2019 19:10:46 UTC+3, Bonita Montero wrote: >> [re-added] Keith Thompson wrote: >> > Sorry, my mistake. I meant that if you have >> > struct foo { int i; char c; } >> > then an array of struct foo will result in misaligned members, >> > even though there likely won't be for a single object. >> >> No, the structure-size is rounded up for that. > > Not when #pragma pack(1) is used like they discussed. It will > erase such padding. And the quoted (but not attributed) text was a correction to an earlier statement of mine. In context, the presence of #pragma pack(1) was clear. (I won't respond directly to Bonita as long as she inists on deleting attribution lines.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */