c - Is it a given or an assumption that all POSIX/SUS signals are a #define? -


signals differ between implementation. there nice tables in apue (advanced programming in unix environment), such "figure 10.1 unix system signals" on page 292 of 2nd edition.

so let's take exemplary sigwaiting. signals appear in documentation int, implementations seem use #define instead of const int.

however, standard stipulate anywhere 1 can rely on signals being #defined? or can assume based on fact that, say, virtually every existing implementation uses #define. or bad assumption altogether?

the rationale this: if can rely on #define being used, can use #ifdef hide more exotic signals implementations don't use it. const int constant names not aware of similar mechanism allow compile time decision made.

see posix (2008, 2013) specification <signal.h>. in part, says:

the <signal.h> header shall define following macros used refer signals occur in system. signals defined here begin letters sig followed uppercase letter. macros shall expand positive integer constant expressions type int , distinct values. value 0 reserved use null signal (see kill()). additional implementation-defined signals may occur in system.

the following signals shall supported on implementations…

and followed table of signal names. version link 2004 edition of standard, , not explicit signal names being macros, later version codifies existing practice.

so, posix conformant, signal names shall #define'd.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -