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

  • Home
  • SEARCH
  • 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 8571357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:45:51+00:00 2026-06-11T18:45:51+00:00

I created a C++ library. I am using it in an iOS application. I

  • 0

I created a C++ library. I am using it in an iOS application. I thought of handling exceptions in C++ library and in order to test this I created a test scheme and called the c++ function from it. In the c++ function I intentionally wrote erroneous code.

try 
{
    int i = 0;
    int j = 10/i;
} 
catch(std::exception &e){
    printf("Exception : %s\n",e.what());
}

But the exception is never caught and the application breaks at – int j = 10/i;

Please tell me, how can I add exception handling to my c++ code in this scenario?

Thanks.

  • 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-06-11T18:45:52+00:00Added an answer on June 11, 2026 at 6:45 pm

    C++ doesn’t throw an exception when a division by zero is encountered (see also this and this other questions)! Quoting Stroustrup:

    low-level events, such as arithmetic overflows and divide by zero, are
    assumed to be handled by a dedicated lower-level mechanism rather than
    by exceptions. This enables C++ to match the behaviour of other
    languages when it comes to arithmetic. It also avoids the problems
    that occur on heavily pipelined architectures where events such as
    divide by zero are asynchronous.

    “The Design and Evolution of C++” (Addison Wesley, 1994)

    So you will have to handle this case yourself – you’ll have to check each potential divisor before division and handle it.

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

Sidebar

Related Questions

I've created a custom library using singleton pattern. Why by this way? because I
I have created an android application that calls (using kSOAP library) a SOAP based
I created application which uses wxWidgets library using visual studio 2008. Now I would
Using this guide I have created a static library (let's call it AppCore )
I am new to iOS.I created the static library file using http://www.icodeblog.com/2011/04/07/creating-static-libraries-for-ios/ When I
I'm building a VoIP handset application on iOS (using the PJSIP library), and PJSIP
I have created a Class Library (Core Processing Component) using C# in Visual Studio
I am using the apache library. I have created a class which sends a
I've created an ics file using DDay iCal library. Now I want to make
Actually I created a button using the cobogw widget library. But the button does

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.