PRB: #pragma pack Can Generate Compiler Warnings (98314)
The information in this article applies to:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++ for Windows, 16-bit edition 1.51
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Editions 4.2
- Microsoft Visual C++, 32-bit Editions 5.0
- Microsoft Visual C++, 32-bit Editions 6.0
This article was previously published under Q98314 SYMPTOMS
When an application uses the pack pragma, C/C++ the compiler generates the
following message:
warning C4103 used #pragma pack to change alignment
Microsoft Visual C++ 5.0 generates a different warning:
warning C4653: compiler option 'structure packing (/Zp)'
inconsistent with precompiled header;
current command-line option ignored
CAUSE
The pragma pack argument differs from the structure packing option
specified on the compiler command line. This warning was added to the
compiler because third-party tools can change the performance of user code
by including a pragma pack message in library include files. The warning
message is designed to indicate potential bugs in code under development.
RESOLUTION
If the code restores the pack argument to the structure packing option
specified on the compiler command line, the warning does not occur. The
sample code below demonstrates restoring the compiler default.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbCompiler kbprb KB98314 |
---|
|