VC ++ warning c4290

Source: Internet
Author: User

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 ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.