Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22032

Can I detect and change the current data alignment setting for structures in gcc/g++?

$
0
0

My question is based off a part of this wiki answer to the question of Why isn't sizeof for a struct equal to the sum of sizeof of each member?:

"IMPORTANT NOTE: Both the C and C++ standards state that structure alignment is implementation-defined. Therefore each compiler may choose to align data differently, resulting in different and incompatible data layouts. For this reason, when dealing with libraries that will be used by different compilers, it is important to understand how the compilers align data. Some compilers have command-line settings and/or special #pragma statements to change the structure alignment settings."

  • Is it possible to detect and change the current structure alignment setting in gcc/g++?
  • And if so, How do I detect the current alignment setting + how can I change it in gcc/g++?

Thank you very much for your help.


Viewing all articles
Browse latest Browse all 22032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>