Here is an example how to set the current #pragma pack:
#pragma pack(4)
How is it possible to show the current #pragma pack setting?
With Microsoft's C++ compiler you can use
#pragma pack(show)
which causes the compiler to issue a warning containing the value.
Note this is not standard C++ (and neither is any guise of #pragma pack
) so other compilers may or may not have this feature. At the time of writing GCC, for example, doesn't.
For Microsoft Visual C++ use
#pragma pack(show)
It will generate the following compiler warning:
Warning C4810 value of pragma pack(show) == 4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With