Re: Data alignment problems with sizeof and new



astdsoftware <astdsoftware@xxxxxxxxxxxxxxxx> wrote:
> I have a strange problem with a project involving classes with data
> alignment padding. It appears that, in this particular project, the
> sizeof and new operators are not taking the alignment padding into
> account when calculating the size of an object. The struct member
> alignment is set to 8 (/Zp8), and there are no #pragma pack
> directives.

Make sure /Zp8 is set on the whole project and not overridden on
individual files. It appears that different source files get compiled
with different packing. Check the build log to be sure this is not the
case.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.