Mail Archives: djgpp-workers/2003/11/04/15:00:58
Hello.
KB Williams wrote:
[snip]
> "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?
[snip]
As I intepret it:
An "identifier with external linkage" in this case would be a global variable.
I guess the two options you have are:
(1) In a new source module define a library internal function to return the
error-handling status. E.g.:
#include <math.h>
static const int __math_errhandling = MATH_ERRNO|MATH_ERREXCEPT;
int __get_math_errhandling (void)
{
return __math_errhandling;
}
Then in <math.h> define the macro to call the function:
extern int __get_math_errhandling(void);
#define math_errhandling (__get_math_errhandling());
(2) Just define the macro:
#define math_errhandling (MATH_ERRNO|MATH_ERREXCEPT)
I prefer (1), because it keeps the details out of <math.h>.
Bye, Rich =]
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
"You can't evaluate a man by logic alone." -- McCoy, "I, Mudd", Star Trek
- Raw text -