VS2010 warning level in Introjucer

Dear Jules,
Just for curiosity, why Introjucer renders VS projects with /W4 warning level? If I am not wrong, the ‘let’s say default Microsoft level’ is /W3. So, a lot of warnings appears in mode 4.


I think that’s a sign that you should fix your code, not reduce the warning level! :wink:

Coming from you is certainly a great tip. We will listen.



What is your approach to dealing with double <–> float <–> int conversion warnings about loss of data, even when you know that the calculation is right as-is? I don’t see a whole bunch of static_cast<> with numeric types in the Juce code…

But there is nothing right “as-is” when you for example assign a double to a float var. Than the compiler has to cast them to another type, this should be an error not a warning imho.
So whats wrong with good old c-style (float) (int) (double) casts, for those elementary types? Doing it explicit and the compiler doesn’t has to guess.

In code where it’s a totally straightforward primitive-numeric-type-to-other-primitive-numeric-type cast, then I do tend to just use an old-fashioned C cast, because in that case static_cast just makes the code more long-winded without adding anything useful. But of course if there’s any chance that templates or non-primitive types are involved, a static_cast would always be best.