delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/11/04/15:00:58

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3FA80338.C83BB2BD@phekda.freeserve.co.uk>
Date: Tue, 04 Nov 2003 19:51:20 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: C99 Functions Under Development and Checkout
References: <178 DOT 21df22b4 DOT 2cd92cee AT aol DOT com>
Reply-To: djgpp-workers AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019