Take the 2-minute tour ×

I'm learning my way around visual studio at the moment. If I've turned set /Wall -- I'll be greeted with a seemingly unhealthy amount of warning messages although my application will compile just fine.

Is this normal? Changing the error level will stop the messages. It looks as if they are all related to the C++ STL or its header files - same thing?

If I build the program using code::blocks (GCC) then no errors are reported despite the same warning level.

What's going on here?

update: visual studio /Wall output: http://pastebin.com/FBGLd2Hb visual studio /W4 output: http://pastebin.com/YuWKVS9G

The code is actually from Wrox Professional C++. I could be wrong about my usage of the word warnings?

share|improve this question
We'd like to tell you whether those warnings are normal or not, but we cannot guess what those warnings are :) –  ereOn Oct 20 '10 at 8:09
good point. updated with a link to the output in question. –  aLostMonkey Oct 20 '10 at 8:17
More than 3000 warnings ?! That's insane oO I will check on one of my projects to see if I can reproduce this. –  ereOn Oct 20 '10 at 8:24
add comment

1 Answer

up vote 4 down vote accepted

With g++ -Wall does not turn on all warnings, just a practical subset. I suspect that with MSVC /Wall turns on more warnings than is practical. MSVC is very enthusiastic about warnings.

With MSVC use /W4 for high warning level.

You'll have to turn off MSVC sillywarnings; you can use my anti-MSVC-sillywarnings header for that.

Cheers & hth.,

share|improve this answer
@ereOn: the warnings turned off by that file rarely indicate real problems. If they do then it's by happenchance. The negative impact of the warnings is, however, real. You're the first who has thought any of those warnings indicate real problems. Quite a few people have been involved in constructing that list. Cheers & hth., –  Cheers and hth. - Alf Oct 20 '10 at 8:23
@Alf P. Steinbach: "disable:4099", "first seen using 'struct' now seen using 'class'" --> this is a real concern, C++ does not mandate that both resolve to the same entity which effectively authorize compilers to emit different (mangled) names. I seem to recall that MSVC did it, perhaps it doesn't any longer. Anyway this one is easily fixed. Explicitly handling all enum values is also a good thing (at the very least, for documentation). I think you may have been a bit too enthusiastic too :) –  Matthieu M. Oct 20 '10 at 8:31
@Mattieu: re 4099, it's a judgment call. You can read my thinking about it, with some examples, here, which -- heh -- links back to StackOverflow... Perhaps in some shops it's better turned on. Re the enum values in a switch, as I recall it's a warning emitted even when you have a default, so, very high nuisance factor. Cheers, –  Cheers and hth. - Alf Oct 20 '10 at 8:37
@jalf: Almost done. I'm dining with Steve Ballmer tonight. Keeping you posted :) –  ereOn Oct 20 '10 at 12:46
Regarding the "sillywarnings", some have even errors in the MSDN references. E.g msdn.microsoft.com/en-us/library/2cf74y2b.aspx explains that you get a warning because this class can't be instantiated (so why not give an error if I tried!?), but the struct in the example can be instantiated as an aggregate - even with VC++ :) –  UncleBens Oct 20 '10 at 15:34
show 6 more comments

Your Answer


