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: Sat, 10 Aug 2019 17:40:21 -0700 Organization: None to speak of Lines: 31 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="cb4b2dc0baf4fefc9628bc1b5f7f50df"; logging-data="27227"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+DsL+s1ySe8i3QJRnZCC85" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:V2zWfyo996k9ugrnyWjxBmbwpM0= sha1:PuECb+J7J5YlgEc6Om63LpW63Wk= Xref: csiph.com comp.lang.c++:67547 David Brown writes: > On 10/08/2019 17:31, Bonita Montero wrote: >>>> More importantly here, it also does not mean you can take pointers >>>> to the unaligned members and use them as normal pointers, ... >> >>> Quote the part of the standard that says that. >> >> Oh, I wasn't correct here: since #pragma pack is a compiler-specific >> feature it sould be specified by the compiler-documentation that it >> isn't legal to take the address of an unaligned member. >> So show me some compilers documentations that say that it isn't >> legal to take the address of an unaligned member! > > No, it would take compiler-specific documentation to say that it /is/ > legal to take the address of an unaligned packed member - because the > standard already says that this is undefined behaviour. Thus if a > compiler wants to say it is allowed, it must document it. If you're going to talk about things that are "legal" or "allowed", please define what you mean by those words. The standard doesn't use them. Is the program ill-formed? Is its behavior undefined? Does it violate a diagnosable rule? There are very few things that are not *allowed* by the language. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */