X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f From: Kbwms AT aol DOT com Message-ID: <178.21df22b4.2cd92cee@aol.com> Date: Tue, 4 Nov 2003 11:25:18 EST Subject: Re: C99 Functions Under Development and Checkout To: djgpp-workers AT delorie DOT com MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="part1_178.21df22b4.2cd92cee_boundary" X-Mailer: 8.0 for Windows sub 6021 Reply-To: djgpp-workers AT delorie DOT com --part1_178.21df22b4.2cd92cee_boundary Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Greetings: I have reached the point where I need to implement the requirements stated in paragraph 7.12 Mathematics , subparagraph 9, of ISO/IEC 9899:1999 (E). The standard calls for establishment of three macros: MATH_ERRNO MATH_ERREXCEPT which "shall expand to the integer constants 1 and 2, respectively," and math_errhandling which "shall expand to an expression that has type int and the value MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR of both." The Standard goes on to say, "The value of math_errhandling is constant for the duration of the program. It is unspecified whether math_errhandling is a macro or an identifier with external linkage." So, which is the better way to proceed? Should math_errhandling be a macro or an identifier with external linkage? If it is an identifier with external linkage, how can that be implemented? Appended to this email as a postscript in my most-recent communication on this thread. KB Williams ===================================================== PS In a message dated 10/28/2003 9:53:59 AM Eastern Standard Time, Kbwms writes: > Subj: Re: C99 Functions Under Development and Checkout > Date: 10/28/2003 9:53:59 AM Eastern Standard Time > From: Kbwms > To: djgpp-workers AT delorie DOT com > > > > A continuing problem that should be solved soon is not knowing what to do in > the math functions when an error occurs. All function specifications at > > http://www.opengroup.org/onlinepubs/007904975/toc.htm > > contain the following text: > > On error, the expressions (math_errhandling &MATH_ERRNO) and > (math_errhandling &MATH_ERREXCEPT) are independent of each > other, but at least one of them must be non-zero. > > At the moment, every function assumes that both expressions are non-zero > because neither 'math_errhandling' nor 'MATH_ERREXCEPT' is defined. > > My intention is to implement the aforementioned variables and modify all > existing code to check those expressions. At the beginning, both expressions > will be non-zero. > > Appended to this email as a postscript are specifications taken from math.h > at the linkage given above. > > > Is this the desired behavior? > > > KB Williams > > > PS > > > > >> The following macros shall expand to the integer constants 1 and 2, >> respectively; >> >> >> >>> MATH_ERRNO >>> MATH_ERREXCEPT >>> >> >> The following macro shall expand to an expression that has type int and the >> value MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR of both: >> >>> math_errhandling >>> >> >> The value of math_errhandling is constant for the duration of the program. >> It is unspecified whether math_errhandling is a macro or an identifier with >> external linkage. If a macro definition is suppressed or a program defines >> an identifier with the name math_errhandling, the behavior is undefined. If >> the expression (math_errhandling &MATH_ERREXCEPT) can be non-zero, the >> implementation shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW >> in . >> >> > --part1_178.21df22b4.2cd92cee_boundary Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Greetings:

I have reached the point where I need to implement the requirements stated i= n paragraph 7.12 Mathematics <math.h>, subparagraph 9, of ISO/IEC 9899= :1999 (E).  The standard calls for establishment of three macros:

MATH_ERRNO
MATH_ERREXCEPT

which "shall expand to the int= eger constants 1 and 2, respectively," and

math_errhandling

which "shall expand to an expression that has type int and the value=20= MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR of both."


The Standard goes on to say,

"The value of math_errhandling is constant for the duration of the program.&= nbsp; It is unspecified whether math_errhandling is a macro or an identifier= with external linkage."

So, which is the better way to proceed?  Should math_errhandling be a m= acro or an identifier with external linkage?  If it is an identifier wi= th external linkage, how can that be implemented?


Appended to this email as a postscript in my most-recent communication on th= is thread.


KB Williams

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
PS

In a message dated 10/28/2003 9:53:59 AM Eastern Standard Time, Kbwms writes= :

Subj: Re: C99 Functions Under Development and Checkout <= /B>
Date: 10/28/2003 9:53:59 AM Eastern Standard Time
From: Kbwms
To: djgpp-workers AT delorie DOT com<= /A>



A continuing problem that shou= ld be solved soon is not knowing what to do in the math functions when an er= ror occurs.  All function specifications at

http://www= .opengroup.org/onlinepubs/007904975/toc.htm

contain the following text:

    On error, the expressions (math_errhandling &MATH_ERR= NO) and
    (math_errhandling &MATH_ERREXCEPT) are independent of= each
    other, but at least one of them must be non-zero.

At the moment, every function assumes that both expressions are non-zero bec= ause neither 'math_errhandling' nor 'MATH_ERREXCEPT' is defined.

My intention is to implement the aforementioned variables and modify all exi= sting code to check those expressions.  At the beginning, both expressi= ons will be non-zero.

Appended to this email as a postscript are specifications taken from math.h=20= at the linkage given above.


Is this the desired behavior?


KB Williams


PS



The following macros shall expa= nd to the integer constants 1 and 2, respectively;


MATH_ERRNO
MATH_ERREXCEPT


The following macro shall expand to an expression that has type int a= nd the value MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR of both= :
math_errhandling


The value of math_errhandling is constant for the duration of the program. I= t is unspecified whether math_errhandling is a macro or an identifier with e= xternal linkage. If a macro definition is suppressed or a program defines an= identifier with the name math_errhandling, the behavior is undefined. If th= e expression (math_errhandling &MATH_ERREXCEPT) can be non-zero, the imp= lementation shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLO= W in <fenv.h>.
=











--part1_178.21df22b4.2cd92cee_boundary--