[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix for _Complex_I problems

From: Rainer Tammer
Subject: Re: Fix for _Complex_I problems
Date: Wed, 13 Feb 2008 08:03:32 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv: Gecko/20070326 Thunderbird/ Mnenhy/

Hello Greg,

Greg Troxel wrote:
I cannot test on Solaris; I was reporting a problem that a pkgsrc user had.

The fix looks like it will work, but I am not comfortable with it.  It
mucks up the source with local defines to hack around lack of standards
compliance.  Reading the second diff, there's much less of this.

As far as I can tell, C99 says that if complex.h is there then
_Complex_I has to work.  This is the reason why I'm being cranky about
defining around it.

On AIX _Complex_I is working if you use the IBM compiler (inline function). But if you use gcc then
you are doomed...
I would prefer to use the compile test that you wrote, but to undefine
HAVE_COMPLEX_H if it fails, thus falling back to not using the
(therefore broken) complex support at all.  I had meant to suggest this,
and I'm sorry if I didn't manage to do that.

Adding a remedial

#define _Complex_I 1.0fi

to the beginning of numbers.c if _Complex_I weren't defined would seem
less objectionable, and also work.


#define complex    _Complex

* a constant expression of type const float _Complex with the
* value of the imaginary unit. (a number i such that i**2 =-1).
* __I is provided by the AIX xlc C99 compiler.
* WARNING: DO NOT USE __I DIRECTLY in an application. Always
* use _Complex_I .
#define _Complex_I    __I

* _Imaginary_I should be a constant expression of type
* const float _Imaginary with the value of the imaginary unit.
* This is optional in C99.
* This is not supported in the AIX xlc C99 compiler.

* C99 requires this definition of the
* very common variable "I", to use as a simpler way
* to say _Complex_I. Mathematicians who would say
* "3i" will now say in C "3 * I".
#undef I
#define I _Complex_I

Thanks for paying attention to this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]