盈彩体育注册(中国)有限公司 | 您所在的位置:网站首页 › 盈彩体育注册(中国)有限公司 › Structure |
Next: Weak Pragmas, Previous: Symbol-Renaming Pragmas, Up: Pragmas Accepted by GCC [Contents][Index] 6.64.10 Structure-Layout Pragmas ¶For compatibility with Microsoft Windows compilers, GCC supports aset of #pragma directives that change the maximum alignment ofmembers of structures (other than zero-width bit-fields), unions, andclasses subsequently defined. The n value below always is requiredto be a small power of two and specifies the new alignment in bytes. #pragma pack(n) simply sets the new alignment. #pragma pack() sets the alignment to the one that was ineffect when compilation started (see also command-line option-fpack-struct[=n] see Options for Code Generation Conventions). #pragma pack(push[,n]) pushes the current alignmentsetting on an internal stack and then optionally sets the new alignment. #pragma pack(pop) restores the alignment setting to the onesaved at the top of the internal stack (and removes that stack entry).Note that #pragma pack([n]) does not influence this internalstack; thus it is possible to have #pragma pack(push) followed bymultiple #pragma pack(n) instances and finalized by a single#pragma pack(pop).Some targets, e.g. x86 and PowerPC, support the #pragma ms_structdirective which lays out structures and unions subsequently defined as thedocumented __attribute__ ((ms_struct)). #pragma ms_struct on turns on the Microsoft layout. #pragma ms_struct off turns off the Microsoft layout. #pragma ms_struct reset goes back to the default layout.Most targets also support the #pragma scalar_storage_order directivewhich lays out structures and unions subsequently defined as the documented__attribute__ ((scalar_storage_order)). #pragma scalar_storage_order big-endian sets the storage orderof the scalar fields to big-endian. #pragma scalar_storage_order little-endian sets the storage orderof the scalar fields to little-endian. #pragma scalar_storage_order default goes back to the endiannessthat was in effect when compilation started (see also command-line option-fsso-struct=endianness see Options Controlling C Dialect).Next: Weak Pragmas, Previous: Symbol-Renaming Pragmas, Up: Pragmas Accepted by GCC [Contents][Index] |
CopyRight 2018-2019 盈彩体育注册(中国)有限公司 版权所有 豫ICP备16040606号-1 |