Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #9566
| From | Andrey Tarasevich <andreytarasevich@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Is #pragma pack violates ODR for classes? |
| Date | 2011-08-31 09:33 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <j3lnnl$k2d$1@dont-email.me> (permalink) |
| References | <307c82de-3f68-45dd-911a-f9b748a9d710@n12g2000yqh.googlegroups.com> |
On 8/30/2011 9:41 PM, Fedor Rodikov wrote: > This #include directive enclosed by #paragma pack in each cpp and the > value of this packing not the same. Does the X violate ODR or not? > Could a different packing in different translation units leads to UB? Well, '#pragma pack' is not really a part of the language specification (at least yet), so there's no formal answer to your question. But if you understand the rationale behind various ODR requirements, you have to conclude that using different packing for the same class in different translation units does indeed violate the intended restrictions of ODR. So, with above remarks, the behavior is de-facto undefined. -- Best regards, Andrey Tarasevich
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is #pragma pack violates ODR for classes? Fedor Rodikov <rodikov.fedor@gmail.com> - 2011-08-30 21:41 -0700
Re: Is #pragma pack violates ODR for classes? Ian Collins <ian-news@hotmail.com> - 2011-08-31 16:58 +1200
Re: Is #pragma pack violates ODR for classes? Fedor Rodikov <rodikov.fedor@gmail.com> - 2011-08-31 00:05 -0700
Re: Is #pragma pack violates ODR for classes? James Kanze <james.kanze@gmail.com> - 2011-09-01 16:00 -0700
Re: Is #pragma pack violates ODR for classes? Goran <goran.pusic@gmail.com> - 2011-08-31 00:23 -0700
Re: Is #pragma pack violates ODR for classes? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2011-08-31 09:33 -0700
Re: Is #pragma pack violates ODR for classes? Fedor Rodikov <rodikov.fedor@gmail.com> - 2011-09-01 02:52 -0700
csiph-web