Actual floating-point exceptions are a complicated subject because there are many types of exceptions with subtly different meanings,and theSIGFPE signal doesn't distinguish between them. TheIEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985)defines various floating-point exceptions and requires conforming computer systems to report their occurrences. However,this standard does not specify how the exceptions are reported,or what kinds of handling and control the operating system can offer to the programmer.
SIGFPEhandler with an extra argument that distinguishes various causes of the exception. In order to access this argument,you must define the handler to accept two arguments,which means you must cast it to a one-argument function type in order to establish the handler. The GNU library does provide this extra argument,but the value is meaningful only on operating systems that provide the information (BSD systems and GNU systems).
FPE_INTOVF_TRAP
-
Integer overflow (impossible in a C program unless you enable overflow trapping in a hardware-specific fashion).
FPE_INTDIV_TRAP
-
Integer division by zero.
FPE_SUBRNG_TRAP
-
Subscript-range (something that C programs never check for).
FPE_FLTOVF_TRAP
-
Floating overflow trap.
FPE_FLTDIV_TRAP
-
Floating/decimal division by zero.
FPE_FLTUND_TRAP
-
Floating underflow trap. (Trapping on floating underflow is not normally enabled.)
FPE_DECOVF_TRAP
-
Decimal overflow trap. (Only a few machines have decimal arithmetic and C never uses it.)
intSIGILL
-
The name of this signal is derived from "illegal instruction"; it usually means your program is trying to execute garbage or a privileged instruction. Since the C compiler generates only valid instructions,
SIGILL typically indicates that the executable file is corrupted,or that you are trying to execute data. Some common ways of getting into the latter situation are by passing an invalid object where a pointer to a function was expected,or by writing past the end of an automatic array (or similar problems with pointers to automatic variables) and corrupting other data on the stack such as the return address of a stack frame.
SIGILL can also be generated when the stack overflows,or when the system has trouble running the handler for a signal.
(编辑:青岛站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|