delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/04/03:16:23

From: edkiser AT my-dejanews DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Includes and some interesting errors
Date: Thu, 04 Jun 1998 07:09:11 GMT
Organization: Deja News - The Leader in Internet Discussion
Lines: 46
Message-ID: <6l5h6n$1sb$1@nnrp1.dejanews.com>
References: <3574046C DOT EBFE2F25 AT larc DOT nasa DOT gov>
NNTP-Posting-Host: 209.54.220.175
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <3574046C DOT EBFE2F25 AT larc DOT nasa DOT gov>,
  "Nathan T. Moore" <n DOT t DOT moore AT larc DOT nasa DOT gov> wrote:
> it *seems* like there is a missing #ifdef ... #endif
> in a header file somewhere, but I could be wrong.

That's what I thought, too. So I went into math.h and
inserted a couple of lines...

#ifndef SHUT_UP_DUPLICATE_EXCEPTION
struct exception {
	int type;
	char *name;
	double arg1;
	double arg2;
	double retval;
};
#endif

and further down (optionally, since before I added it, the errors
were already gone, but it seemed cleaner to add it)

#ifndef SHUT_UP_DUPLICATE_EXCEPTION
extern int matherr(struct exception *);
#endif

I think you can see what I inserted.

Then all you do is, before you #include <math.h>, if you're going
to use any Standard Template Library, just

#define SHUT_UP_DUPLICATE_EXCEPTION

It's that easy.

But it's a hack.

I wish the "struct exception" could be renamed, but apparently
"struct exception" is part of the BSD UNIX standard for numerics,
and the other "exception" is part of the ANSI C++ standard, and
there is a name conflict. I don't use the BSD UNIX stuff, and math.h
is easier to understand, therefore, this hack.

Namespaces might help fix this in a future GCC.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

- Raw text -


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