Hello Jules from TSC :mrgreen:
I have still C++ warnings when I’m compiling something with the INTEL compiler with Windows 7 + Visual Studio 2008. I have seen the change you have done, but it does not solve the problem. To get everything working, I need to define “__INTEL_COMPILER” in the Preprocessor Definitions of my project (I have Intel Compiler 2011, I imagine this definition may be done automatically with more recent versions maybe ?). Then, I have changed the part of the code which gives the issue :
[code]//==============================================================================
#if JUCE_MSVC
#pragma optimize (“t”, off)
#ifndef __INTEL_COMPILER
#pragma float_control (precise, on, push)
#endif
#endif
/** Fast floating-point-to-integer conversion.
This is faster than using the normal c++ cast to convert a float to an int, and
it will round the value to the nearest integer, rather than rounding it down
like the normal cast does.
Note that this routine gets its speed at the expense of some accuracy, and when
rounding values whose floating point component is exactly 0.5, odd numbers and
even numbers will be rounded up or down differently.
*/
template
inline int roundToInt (const FloatType value) noexcept
{
#ifdef __INTEL_COMPILER
#pragma float_control (precise, on, push)
#endif
union { int asInt[2]; double asDouble; } n;
n.asDouble = ((double) value) + 6755399441055744.0;
#if JUCE_BIG_ENDIAN
return n.asInt [1];
#else
return n.asInt [0];
#endif
}
#if JUCE_MSVC
#ifndef __INTEL_COMPILER
#pragma float_control (pop)
#endif
#pragma optimize ("", on) // resets optimisations to the project defaults
#endif
/** Fast floating-point-to-integer conversion.
This is a slightly slower and slightly more accurate version of roundDoubleToInt(). It works
fine for values above zero, but negative numbers are rounded the wrong way.
*/
inline int roundToIntAccurate (const double value) noexcept
{
#ifdef __INTEL_COMPILER
#pragma float_control (pop)
#endif
return roundToInt (value + 1.5e-8);
}[/code]
The compiler is telling me that the pragma stuff is only allowed inside a function and at the beginning of the function…