BUG: Limitation w/ Disabling Warnings Above 4699 w/ #pragma

Last reviewed: July 24, 1997
Article ID: Q120968
The information in this article applies to:
  • Microsoft C/C++ Compiler (CL.EXE) included with: - Microsoft Visual C++ for Windows, version 1.5 - Microsoft Visual C++, 32-bit Edition, versions 1.0, 2.0, 4.0, 4.1,

         4.2, 5.0
    

SYMPTOMS

Disabling a warning with #pragma warning will not succeed if the pragma is placed within the function where the warning occurs and the warning has a value of 4700 or greater.

CAUSE

Warnings greater than 4699 are generated by the second and third passes of the compiler.

RESOLUTION

To disable warnings with a value of 4700 or greater, place the #pragma warning outside of any function.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Sample Code

The following sample code demonstrates the problem:

   /* Compile options needed: /W4
   */

   float big;
   float big2;
   int junk1;

   /* Use this pragma instead of the one below to disable all
   warnings     */
   /* #pragma
   warning(disable:4756;disable:4706;disable:4699;disable:4244)
   */

   void main(void)
   {
      int i;

   /* This pragma will disable only the warnings < 4699 because
   of its placement within the function body */

   #pragma
   warning(disable:4756;disable:4706;disable:4699;disable:4244)

      big = +1.0e+99;
      big2 = +1.1e+99;
      junk1 = i;
      if( i=0 )
         i=0;
   }


Additional query words: 8.00 8.00c 9.00 10.00 10.10 10.20
Keywords : CLIss kbcode vcbuglist500
Version : 1.5 1.0 2.0 4.0 4.1 4.2 5.0
Platform : NT WINDOWS
Issue type : kbbug


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 24, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.