SIG_DFL, SIG_IGN - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# SIG_DFL, SIG_IGN

From cppreference.com
< c‎ | program

Defined in header `<signal.h>` |  |
#define SIG_DFL /*implementation defined*/ |  |
#define SIG_IGN /*implementation defined*/ |  |

The SIG_DFL and SIG_IGN macros expand into integral expressions that are not equal to an address of any function. The macros define signal handling strategies for signal() function.

Constant | Explanation
`SIG_DFL` | default signal handling
`SIF_IGN` | signal is ignored

### [edit] Example

Run this code

    #include <signal.h>
    #include <stdio.h>

    int main(void)
    {
        /* using the default signal handler */
        raise(SIGTERM);
        printf("Exit main()\n");   /* never reached */
    }

Output:

    (none)

### [edit] Example

Run this code

    #include <signal.h>
    #include <stdio.h>

    int main(void)
    {
        /* ignoring the signal */
        signal(SIGTERM, SIG_IGN);
        raise(SIGTERM);
        printf("Exit main()\n");
    }

Output:

    Exit main()

### [edit] See also

C++ documentation for SIG_DFL, SIG_IGN

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/program/SIG_strategies&oldid=69700"