Machine-translated by Google. Questions are authored in English.
Top

Discussion

Applying a packed attribute to a structure removes the padding but

  • A.forces the structure into read-only memory
  • B.may make member access slower or unaligned
  • C.changes the order of the members in memory
  • D.prevents the structure from being passed to a function

Answer: B

On a core that cannot fetch an unaligned word the compiler must generate several byte accesses instead of one, and on some cores an unaligned access faults outright. Packing is for matching an external format, not for saving memory in internal structures.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.