__alignof The alignment of the largest element in the value structure is required.
Why ??
Where do you get quotes from? If you interpret it interpretively, then it is very wrong, for example:
strates s {char array [100]; Long x; }
Obviously, the alignment of the structure is not
x of
array . The rule should be read:
The alignment of a structure is similar to the highest alignment similar to the equality.
Now, above the actual question, why does the structure have to do this alignment? Well, imagine that you have an organization and within it is to use a member. If the structure has less alignment than the embedded member, then accessing the member can be done in an unreserved manner, which will generally trigger the runtime error from the underlying hardware.
Comments
Post a Comment