RAD Studio
ContentsIndex
PreviousUpNext
W8078: Throw expression violates exception specification (C++)

(Command-line option to suppress warning: -w-thr) 

This warning happens when you add an exception specification to a function definition and you throw a type in your function body that is not mentioned in your exception specification. 

The following program would generate this warning:

int foo() throw(char*)  // I promise to only throw char*s

 

{

 

    throw 5;  // Oops, I threw an integer

 

    return 0;

 

}
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!