From bb5baf62e80f3ab9470fab2580e478a39eebac01 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Wed, 30 Jul 2008 07:16:18 +0000 Subject: [PATCH] NOTES: Summarize the state of glibc support for exceptions and errno for error reporting. --- man7/math_error.7 | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/man7/math_error.7 b/man7/math_error.7 index 9638fe392..8662768df 100644 --- a/man7/math_error.7 +++ b/man7/math_error.7 @@ -21,7 +21,7 @@ .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" -.TH MATH_ERROR 7 2008-07-21 "Linux" "Linux Programmer's Manual" +.TH MATH_ERROR 7 2008-07-30 "Linux" "Linux Programmer's Manual" .SH NAME math_error \- detecting errors from mathematical functions .SH SYNOPSIS @@ -48,18 +48,6 @@ as outlined below) described in .BR fenv (3). -C99 and POSIX.1-2001 specify a -.I math_errhandling -identifier, -which is supposed to indicate which of these two mechanisms is in use; -the standards require that at least one be in use, -but permit both to be available. -Although glibc does not support this identifier, -in practice it supports both mechanisms. -.\" I've tested glibc 2.3.3 and glibc 2.8, and both seem to support -.\" both mechanisms. A quick look at the glibc source code suggests -.\" that support goes back to glibc 2.1 at least. -- mtk, Jul 08 - A portable program that needs to check for an error from a mathematical function should set .I errno @@ -196,8 +184,25 @@ or more leading zeros in the significand. .SH NOTES The .I math_errhandling -identifier specified by C99 and POSIX.1-2001 is not supported. +identifier specified by C99 and POSIX.1-2001 is not supported by glibc. .\" See CONFORMANCE in the glibc 2.8 (and earlier) source. +This identifer is supposed to indicate which of the two +error-notification mechanisms +.RI ( errno , +exceptions retrievable via +.BR fettestexcept (3)) +is in use. +The standards require that at least one be in use, +but permit both to be available. +The current (version 2.8) situation under glibc is messy. +Most (but not all) functions raise exceptions on errors. +Some also set +.IR errno . +A few functions set +.IR errno , +but don't raise an exception. +A very few functions do neither. +See the individual manual pages for details. To avoid the complexities of using .I errno