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

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
Date: 05 Nov 2003 07:53:58 +0200
Message-Id: <uznfbfjih.fsf@elta.co.il>
From: Eli Zaretskii <eliz AT elta DOT co DOT il>
To: djgpp-workers AT delorie DOT com
In-reply-to: <200311050038.hA50cEoS001039@speedy.ludd.luth.se>
(ams AT ludd DOT luth DOT se)
Subject: Re: C99 Functions Under Development and Checkout
References: <200311050038 DOT hA50cEoS001039 AT speedy DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: <ams AT ludd DOT luth DOT se>
> Date: Wed, 5 Nov 2003 01:38:14 +0100 (CET)
> 
> According to Richard Dawe:
> > 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)
> 
> (3) just define the variable:
> <math.h>:
> extern int math_errhandling; /* Perhaps with const too. */
> 
> some/path/math_err.c:
> int math_errhandling = SOME_VALUE;

FWIW, I like (1) better, since it makes unwarranted accesses to the
math errhandling mask much harder.

- Raw text -


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