Re: math_error.7 draft 3, for review

Andries E. Brouwer
2008-07-16T21:37:32Z

On Wed, Jul 16, 2008 at 03:47:41PM +0200, Michael Kerrisk wrote:

> There are two signaling mechanism:

mechanisms

> If
> .B_SVID_SOURCE
> is defined, glibc provides the older
> .I matherr ()
> error-reporting framework defined by SVID.

Typo: .B _SVID_SOURCE
But defining this does not suffice, one also needs the magic incantation
_LIB_VERSION = _SVID_;

Example:

/* matherr demo; link with -lm */
#define _SVID_SOURCE
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

int matherr(struct exception *x) {
fprintf(stderr, "math error\n");
exit(1);
}

int main(){
double x;

_LIB_VERSION = _SVID_;

x = sqrt(-1.0);
printf("x=%f\n", x);
return 0;
}

Andries