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 6099251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:15:07+00:00 2026-05-23T13:15:07+00:00

I am reading The Design and Evolution of C++ , by Bjarne Stroustrup. Regarding

  • 0

I am reading The Design and Evolution of C++, by Bjarne Stroustrup. Regarding exeception handling and asynchronous signals it is mentioned as below:

Can exceptions be used to handle things like signals? Almost certainly not in most C environments. The trouble is that C uses functions like malloc that are not re-entrant. If an interrupt occurs in the middle of malloc and causes an exception, there is no way to prevent the exception handler from executing malloc again.

A C++ implementation where calling sequences and the entire run-time library are designed around the requirement for re-entrancy would make it possible for signals to throw exceptoins

What does the author mean by the statement "there is no way to prevent the exception handler from executing malloc again"? How would making functions re-entrant make it possible to throw exceptions from signal handlers?

  • 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-23T13:15:08+00:00Added an answer on May 23, 2026 at 1:15 pm

    In my opinion that part doesn’t really make much sense with current C++.

    In C++ there is no way to use an exception as a signal because signals are meant to be executing an handler and then (possibly) continue execution.

    C++ exceptions however don’t work this way. Once you get to the exception handler the stack has been already rolled back and there is no way to “continue” after the handling: there is no way to get to the statement following a throw (or following a function call during which an exception gets thrown).

    Signals are asynchronous but not disruptive and continuing after a signal is possible (even if of course care must be taken about what is done in the signal handler), exceptions instead are disruptive of the program flow and continuing is impossible.

    I’d say the two ideas are incompatible at a logical level and doesn’t really matter if the library is reentrant or not.

    May be in early C++ design there was a resume option for exceptions…

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

Sidebar

Related Questions

I am currently reading Stroustrup's book "Design and Evolution of C++" and it turns
I am reading about backtracking algorithm design technique. It is mentioned as follows. Backtracking
I am reading Modern C++ design. It was mentioned about sizeof opeator as following
I was reading Design Patterns: Elements of Reusable Object-Oriented Software , (specifically the chapter
I have just started reading Modern C++ Design Generic programming and Design Patterns Applied
Here's an excerpt from a book I'm reading about application design with MVC: Ideally,
I am reading the book Applying-Domain-Driven-Design-Pattern . In its model design, it has the
I have been reading a lot on design patterns lately and some of them
I was reading up on singleton class design in C# on this great resource
I'm reading the book on Domain Driven Design of Eric Evans - Chapter 5

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.