mathimf.h is incompatible with system math.h

Reference number: DPD200166165

Problem : mathimf.h problem in VS2010

Environment : VS2010 , Intel C++ compiler

Affected compilers: 12.0 u/d (1 to 4)

Sample code:

#pragma once

#include <string>
using std::string;

#include <mathimf.h>

class bccb
{
bccb(void);
~bccb(void);
};


bccb::bccb(void)
{
}

bccb::~bccb(void)
{
}

Problem Description:--
When above is compiled with Intel compiler in VS2010 mode, following error:--

# error "<mathimf.h> is incompatible with system <math.h>!"

With VS2008, the code compiles fine.

Solutions/workarounds:--

1. Use math.h instead of mathimf.h, and in case of a needed Intel-specific functions, their definitions can be taken from mathimf.h and inserted into application code.

2. Standard recommendation is to avoid usage of math.h and mathimf.h in the same compilation unit
by separating code that depends on math.h from the code that depends on mathimf.h into dirrerent files.
The above code though has the problem that the use is not avoided. This is an issue needed to be fixed.

3. First, try to include <mathimf.h> before any other header. This will automatically prevent futher inclusions of <math.h>.
So, include <mathimf.h before <string> . But still icl in VS2010 mode does not compile, and this will be fixed in later release. <math.h> should never be mistakenly used before <mathimf.h>, as this would definitely cause problems due to below reason:--

In C language,
MS math.h deprecates usage of some c99-functions.
The issue here is that MS does not support ISO C99.
Also a number of float and long double functions are defined
through calls to corresponding double-precision functions,
giving performance or accuracy loss compared to float/long-double functions
existing in Intel math library.

In C++ language,
MS redefines a number of c99-functions so that they are inlined.

Resolution status:
This issue will be fixed in the later 12.0 release and next major release 12.1.
So, including <mathimf.h> before <math.h> explicitly or inadvertently as in sample code will build fine with VS2010 in later 12.x .

[DISCLAIMER: The information on this web site is intended for hardware system manufacturers and software developers. Intel does not warrant the accuracy, completeness or utility of any information on this site. Intel may make changes to the information or the site at any time without notice. Intel makes no commitment to update the information at this site. ALL INFORMATION PROVIDED ON THIS WEBSITE IS PROVIDED "as is" without any express, implied, or statutory warranty of any kind including but not limited to warranties of merchantability, non-infringement of intellectual property, or fitness for any particular purpose. Independent companies manufacture the third-party products that are mentioned on this site. Intel is not responsible for the quality or performance of third-party products and makes no representation or warranty regarding such products. The third-party supplier remains solely responsible for the design, manufacture, sale and functionality of its products. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. *Other names and brands may be claimed as the property of others.]



For more complete information about compiler optimizations, see our Optimization Notice.