Skip to main content
Inspiring
September 30, 2010
Question

VS/VC++ Struct Member Alignment (set to 4)?

  • September 30, 2010
  • 1 reply
  • 1449 views

I would like to ask why Struct Member Alignement is set to 4 instead to Default (or 8 on x64)?

(in Visual Studio 2008 - Project properties ( -> Configuration  properties) -> C/C++ -> Code Generation -> Struct Member  Alignment)

There were runtime problems after linking with an external library (default alignment); so it might be better to change the skeleton template in SDK.

For example in After Effects CS5 SDK for windows in:

after_effects_cs5_sdk_win\Adobe After Effects CS5 Win SDK\Examples\template\Skeleton\win\Skeleton.vcproj

look for:

StructMemberAlignment="3"

and set it to 0 (default) or at least to 4 (64bit alignment)

StructMemberAlignment="0"

or

StructMemberAlignment="4"

greets

m

This topic has been closed for replies.

1 reply

Inspiring
October 7, 2010

Hi Mike,

I believe you're correct, thanks for pointing that out.  These projects had been brought forward from the CS4 versions, which were 32-bit, and used 4-byte alignment at the time.  Fortunately, the standard headers include PreConfig.h, which sets 8-byte alignment for the AE API structure definitions.  But it makes sense to no longer set 4-byte alignment in the vcprojs.

Cheers,

Zac