Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #9537

Re: Is #pragma pack violates ODR for classes?

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Is #pragma pack violates ODR for classes?
Date 2011-08-31 16:58 +1200
Message-ID <9c5tbfF5dgU7@mid.individual.net> (permalink)
References <307c82de-3f68-45dd-911a-f9b748a9d710@n12g2000yqh.googlegroups.com>

Show all headers | View raw


On 08/31/11 04:41 PM, Fedor Rodikov wrote:
> Hi Group!
>
> Recently I met a problem in a legacy C++ project. This project has
> more than one translation unit which include header with class
> template X.
> 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?

If the compiler takes any notice of the pragma, it certainly would.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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