Re: [guppi-list] Re: changes in goose



Replying to myself seems a bit self-referential, but...

I've been trying out the latest CVS goose with -Wall -ansi -pedantic.
The goal is to get istatfn.cpp:564: warning: implicit declaration of
function `int erfc(...)'

However, you still link properly (since erf and erfc are in there),
but you get flaming death at run-time, as your doubles get converted
to ints before being passed to erf and erfc.

Right now, Asger's erf and erfc are wrapped in a #if defined WIN32.
Now the logical thing to do would be to check for erf via configure,
which would then set HAVE_ERF.  We could then say
   
#ifndef HAVE_ERF
... Asger's erf and erfc code ...
#endif

Since HAVE_ERF would not be set on Windows, this would take care of
it.

But: configure's check will say that the function is there is you meet
with success at link time, regardless of compile-time warnings.  So
HAVE_ERF could be set by configure, but we'd still not find the
prototypes (due to -ansi).  So we'd have to put in thand, a la
 
#ifdef HAVE_ERF
extern "C" {
double erf(double);   /* Yuck!  This is annoying... */
double erfc(double);
}
#else
... Asger's erf and erfc code ...
#endif

I'll do this, but it seems... wrong.  Is there a cleaner way to handle
this sort of thing?

-JT



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