VC ++ warning c4290
Mingyuan 2009/5/9
Two functions are declared:
Int dividefun (int A, int B) Throw (string, INT );
Double sqrtfun (double A) Throw (double );
The following warning is prompted during compilation:
Warning c4290: C ++ exception specification ignored failed t to indicate a function is not _ declspec (nothrow)
Cause:
Http://msdn.microsoft.com/en-us/library/sa28fef8 (vs.80). aspx
Error Message
C ++ exception specification ignored failed t to indicate a function is not _ declspec (nothrow)
A function is declared using exception specification, which Visual C ++ accepts but does not implement. code with exception specifications that are ignored during compilation may need to be recompiled and linked to be reused in future versions Supporting Exception specifications.
Http://msdn.microsoft.com/zh-cn/library/sa28fef8 (vs.80). aspx
Error Message
Ignore the C ++ exception specification, but the indicator function is not _ declspec (nothrow)
The exception specification is used to declare functions. Visual C ++ accepts but does not implement this specification. Code that contains the exception specification ignored during compilation may need to be re-compiled and linked for reuse in future versions that support the exception specification.
For more information, see exception specifications.
Http://msdn.microsoft.com/zh-tw/library/sa28fef8 (vs.80). aspx
�� Information
C ++ exception level, unless indicated by a function, non-_ declspec (nothrow)
The function is declared with an exception that is accepted but not made by Visual C ++. If the program's exceptions are ignored in the program, the program may be re-installed, this feature can be reused in the new version's support exceptions.
Solution:
Add: # pragma warning (Disable: 4290) before function declaration)
The result is as follows:
# Pragma warning (Disable: 4290)
Int dividefun (int A, int B) Throw (string, INT );
Double sqrtfun (double A) Throw (double );
This solution only ensures that the compiler does not bring up any warning, but does not guarantee that the compiler accepts the exception specification (exceptions, exception Specification ).