In my code, I have this
#include <queue>
#include <vector>
I have "warning level 4" and "warnings as errors" turned on.
If I compile my code, it gives me warning C4702 about "unreachable code"
inside the "vector" standard header and warning C4701 about "local variable
x may be used without having been initialized" inside the "xstring"
standard header.
It also gives me C4701 about some things in my code.
I want to disable the warnings in the standard header but not in my code so
I do this:
#pragma warning (disable:4702 4701)
#include <queue>
#include <vector>
#pragma warning (default:4702 4701)
However, now (for some reason), the warnings in my code (which I do want to
trigger) are not triggering
So, firstly, there is a possible bug in the standard header files in that
they cant compile at "warning level 4" and "warnings as errors" and
secondly there is a possible bug in that the #pragma warning (default:4702
4701) statement isnt re-enabling the checks for warning C4702 properly.
If anyone knows more about these bugs (or better yet, how to get things to
do what I want so the warnings in my code trigger and those in the header
files do not), please do let me know.
Jakob Bieling - 27 Jun 2005 06:09 GMT
> I want to disable the warnings in the standard header but not in my
> code so I do this:
[quoted text clipped - 4 lines]
> However, now (for some reason), the warnings in my code (which I do
> want to trigger) are not triggering
You could try if pushing and popping the warning state works for
you:
#pragma warning (push)
#pragma warning (disable : 4702 4701)
#include <queue>
#include <vector>
#pragma warning (pop)
hth

Signature
jb
(reply address in rot13, unscramble first)
Jonathan Wilson - 27 Jun 2005 10:15 GMT
> #pragma warning (push)
> #pragma warning (disable : 4702 4701)
> #include <queue>
> #include <vector>
> #pragma warning (pop)
I tried that and it didnt work either :(