Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6210003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:05:07+00:00 2026-05-24T06:05:07+00:00

i was dealing with the following code,& got confused,please have a look at it

  • 0

i was dealing with the following code,& got confused,please have a look at it

#include<iostream>
#include<conio.h>
#include<string.h>

using namespace std;

void Xhandler(int test) throw(char,double)  /*i am restricting an integer exception     here by not including it in the argument list of throw*/
{
if(test==0) throw test;
if(test==1) throw 'a';
if(test==2) throw 123.23;
}

int main()
{
cout<"start";

try{
    Xhandler(0);  
}

catch(int i)  /*this catch statement must be ignored then,but it is running*/
{
    cout<<"caught an integer"; /*this is the output on the screen*/
}
catch(char c)
{
    cout<<"caught character";
}
catch(double a)
{
    cout<<"caught double";
}

cout<<"end";
    _getch();
    return 0;

     }

the catch statement corresponding to int must be ignored(which is not ignored) & program must have to be terminated as there is no matching catch statement left,but it is not so?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:05:08+00:00Added an answer on May 24, 2026 at 6:05 am

    You did not specified the compiler. If you are using Microsoft visual C++ there is a note at Exception Specifications page on the MSDN

    Visual C++ departs from the ANSI Standard in its implementation of exception specifications. The following table summarizes the Visual C++ implementation of exception specifications:

    …

    throw(type) – The function can throw an exception of type type. However, in Visual C++ .NET, this is interpreted as throw(…).

    When using g++ the process is terminated due unexpected exception when running your example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some difficulty dealing with memory leaks in the following code. Using
I'm dealing with a large code base that uses the following construct throughout class
I have a simple, but perplexing problem, with Math. The following code will take
When dealing with something like a List<string> you can write the following: list.ForEach(x =>
In a web application that I have run across, I found the following code
I'm using the following code to count the number of rows in an html
Having trouble converting the following code from dealing with IDs to Classes. Basicly what
I'm dealing here with a new problem. I started with the following code: -(IBAction)
I'm dealing with some pre-ANSI C syntax. See I have the following function call
I have the following code in an HTML file: socket.on('message',function(data) { console.log('Received a message

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.