[Bug c++/17519] [3.4/4.0 Regression] Warning for array of packed non-POD in packed struct

timb at bluearc dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 27 17:51:00 GMT 2005


------- Additional Comments From timb at bluearc dot com  2005-01-27 17:50 -------
There's certainly a good case for warning about packing that's likely not to
have the desired results - we've been bitten by that before. But that doesn't
really apply to all non-POD; you can define a subset safe-non-POD (broadly
speaking, no virtual functions/bases and (recursively) no unsafe non-static data
members) where everything still has reasonably predictable representations and
you don't need extra space for polymorphism magic.

So if you do go in that direction, please consider separate warnings for those
non-POD types that can nevertheless safely be packed and those that can't.
Classes made non-POD through fairly innoccuous constructions - e.g.
constructors, simple inheritance - are often useful in abstracting hardware
registers, data formats, etc. We'd be swamped in warnings if we got one for
every packed non-POD, but we definitely do want to know if there's something
that's actually going to mess things up.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17519



More information about the Gcc-bugs mailing list