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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:20:26+00:00 2026-05-29T11:20:26+00:00

(Environment: gcc/g++ 4.6.1 in -std=gnu++0x mode on Linux 3.0 / x86_64…) #include <stdlib.h> #include

  • 0

(Environment: gcc/g++ 4.6.1 in -std=gnu++0x mode on Linux 3.0 / x86_64…)

#include <stdlib.h>
#include <signal.h>
#include <iostream>

using namespace std;

class SegmentationFault {};

void ThrowSegmentationFault(int)
{
    throw SegmentationFault();
}

void ohno(char* x)
{
    *x = 42;
}

int main()
{
    signal(SIGSEGV, ThrowSegmentationFault);

    try
    {
        ohno(0);
    }
    catch (const SegmentationFault&)
    {
        cout << "success" << endl;
    }
}

By compiling the above with the -fnon-call-exceptions flag, it allows the SIGSEGV signal handler to throw an exception, and when run it will print “success”. The documentation of the -fnon-call-exceptions gcc flag reads as follows:

Generate code that allows trapping instructions to throw
exceptions. Note that this requires platform-specific runtime support
that does not exist everywhere. Moreover, it only allows trapping
instructions to throw exceptions, i.e. memory references or floating
point instructions. It does not allow exceptions to be thrown from
arbitrary signal handlers such as SIGALRM.

My question is which of the signals are trapping instructions and which are not?

#define SIGHUP           1
#define SIGINT           2
#define SIGQUIT          3
#define SIGILL           4
#define SIGTRAP          5
#define SIGABRT          6
#define SIGIOT           6
#define SIGBUS           7
#define SIGFPE           8
#define SIGKILL          9
#define SIGUSR1         10
#define SIGSEGV         11
#define SIGUSR2         12
#define SIGPIPE         13
#define SIGALRM         14
#define SIGTERM         15
#define SIGSTKFLT       16
#define SIGCHLD         17
#define SIGCONT         18
#define SIGSTOP         19
#define SIGTSTP         20
#define SIGTTIN         21
#define SIGTTOU         22
#define SIGURG          23
#define SIGXCPU         24
#define SIGXFSZ         25
#define SIGVTALRM       26
#define SIGPROF         27
#define SIGWINCH        28
#define SIGIO           29
#define SIGPOLL         SIGIO
/*
#define SIGLOST         29
*/
#define SIGPWR          30
#define SIGSYS          31
#define SIGUNUSED       31
  • 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-29T11:20:27+00:00Added an answer on May 29, 2026 at 11:20 am

    SIGILL, SIGTRAP, SIGBUS, SIGFPE, SIGSEGV, SIGSTKFLT are the most probable synchronous signals (i.e., generated by hardware as consequence of an instruction trying to do something invalid).

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

Sidebar

Related Questions

I'm working in a Linux environment with C++, using the GCC compiler. I'm currently
Using gcc and ld on x86_64 linux I need to link against a newer
My environment is in Linux, using pthreads, compiled in gcc. I have 3 threads
I'm accessing an Ubuntu machine using PuTTY, and using gcc. The default LANG environment
Environment: I am using MS-VC++ 6.0, I include a group of header file with
Developing environment: GNU GCC (g++) 4.1.2 While I'm trying to investigate how to increase
I'm working on Linux gcc environment and I need to initilize function arguments that
#include <iostream> class myFunctorClass { public: myFunctorClass(int x) : _x(x) {} int oprator() (int
I just finished up a class in C/C++ in a Linux environment and when
Environment: linux x64, compiler gcc 4.x Project has following structure: static library slib --

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.