From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/gcc~13/structure-layout-pragmas.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 devdocs/gcc~13/structure-layout-pragmas.html (limited to 'devdocs/gcc~13/structure-layout-pragmas.html') diff --git a/devdocs/gcc~13/structure-layout-pragmas.html b/devdocs/gcc~13/structure-layout-pragmas.html new file mode 100644 index 00000000..6ae12cfd --- /dev/null +++ b/devdocs/gcc~13/structure-layout-pragmas.html @@ -0,0 +1,16 @@ +

6.62.10 Structure-Layout Pragmas ΒΆ

For compatibility with Microsoft Windows compilers, GCC supports a set of #pragma directives that change the maximum alignment of members of structures (other than zero-width bit-fields), unions, and classes subsequently defined. The n value below always is required to be a small power of two and specifies the new alignment in bytes.

  1. #pragma pack(n) simply sets the new alignment.
  2. +
  3. #pragma pack() sets the alignment to the one that was in effect when compilation started (see also command-line option -fpack-struct[=n] see Options for Code Generation Conventions).
  4. +
  5. #pragma pack(push[,n]) pushes the current alignment setting on an internal stack and then optionally sets the new alignment.
  6. +
  7. #pragma pack(pop) restores the alignment setting to the one saved at the top of the internal stack (and removes that stack entry). Note that #pragma pack([n]) does not influence this internal stack; thus it is possible to have #pragma pack(push) followed by multiple #pragma pack(n) instances and finalized by a single #pragma pack(pop).
  8. +

Some targets, e.g. x86 and PowerPC, support the #pragma ms_struct directive which lays out structures and unions subsequently defined as the documented __attribute__ ((ms_struct)).

  1. #pragma ms_struct on turns on the Microsoft layout.
  2. +
  3. #pragma ms_struct off turns off the Microsoft layout.
  4. +
  5. #pragma ms_struct reset goes back to the default layout.
  6. +

Most targets also support the #pragma scalar_storage_order directive which lays out structures and unions subsequently defined as the documented __attribute__ ((scalar_storage_order)).

  1. #pragma scalar_storage_order big-endian sets the storage order of the scalar fields to big-endian.
  2. +
  3. #pragma scalar_storage_order little-endian sets the storage order of the scalar fields to little-endian.
  4. +
  5. #pragma scalar_storage_order default goes back to the endianness that was in effect when compilation started (see also command-line option -fsso-struct=endianness see Options Controlling C Dialect).
  6. +
+

+ © Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
+ https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Structure-Layout-Pragmas.html +

+
-- cgit v1.2.3