1

In case, i want to define the structure alignment at a module level using the compiler flags such as /Zp for cl on windows. What are the alternatives on GCC and clang?

Abhishek Jain
  • 9,614
  • 5
  • 26
  • 40

1 Answers1

0

gcc -v --help gives:

-fpack-struct               Pack structure members together without holes
-fpack-struct=<number>      Set initial maximum structure member alignment

clang has the same switch (at least clang 3.x).

m.s.
  • 16,063
  • 7
  • 53
  • 88
  • On msdn for Zp, it is mentioned that "Packs structures on 8-byte boundaries (default)." Does that mean that if there a data type of size > 8 bytes, by default it would not be naturally aligned and rather will have 8 byte alignment. If yes, is that case with GCC/clang? – Abhishek Jain Jun 24 '15 at 07:41
  • @AbhishekJain sorry I don't know that – m.s. Jun 24 '15 at 07:56