On Mar 18, 8:19 pm, Cactus <[email protected]> wrote:
> On Mar 18, 8:13 pm, Cactus <[email protected]> wrote:
>
>
>
>
>
> > On Mar 18, 7:48 pm, "jason" <[email protected]> wrote:
>
> > [snip]
>
> > > Not defining HAVE_STDINT_H (or removing this definition if it is
> > > defined) in a source code file before mpir.h is included will remove
> > > the stdint.h or cstdint include and all the *_ux and *_sx functions.
>
> > > ---------------------
> > > I was only thinking of putting it in tests/cxx/*.c which dont use the new
> > > functions
>
> > That is true right now but it won't be true when a C++ interface to
> > the new functions gets added
>
> > > But we cannot do this unconditionally in the test _source_ code since
> > > this would turn off the tests in the Visual Studio builds where they
> > > do not cause any problems.
>
> > > So we need something like:
>
> > > #if defined(HAVE_STDINT_H) && !defined(  _MSC_VER )
> > > #  undef HAVE_STDINT_H
> > > #endif
>
> > > Anyone who wants the functions simply puts:
>
> > > #define HAVE_STDINT_H
> > > ---------------------------
> > > Is this the usual way of doing this sort of thing? , it does seem very
> > > hackish...
> > > what do mpfr(don't they have the *_ux thing?) do for example
>
> > They don't include stdint.h in mpfr.h - they have a rather complex set
> > of conditionals that they hope will detect if stdint.h has already
> > been included when mpfr.h itself has been included.
>
> > If these conditionals detect stdint.h they then add the new function
> > declarations.   I looked at a wide range of different stdint.h files
> > on different architecctures to find a sensible guard but,
> > unfortunately, they vary widely in what macros are defined so there is
> > no easy way to detect it (we could copy their detection code but it is
> > just as mach a hack as we have now).
>
> >       Brian
>
> The MPFR team make an extensive comment in mpfr.h about the issues
> involved in trying to detect stdint.h.
>
> This matches what I found when looking at this.

I think we can avoid the C0x issue if we detect stdint.h using the
guard:

#if defined( _STDINT_H ) || defined ( _STDINT_H_ ) || defined
( _STDINT )

around the new functions in mpir.h.

I believe this will detect stdint.h in Windows, L/Unix and MAC but
quite possibly not elsewhere.

If this is good enough I can make this change - what do people think
about the issues that this might create on other architectures?

What macros can be used to detecct stdint.h where the above detection
code will fail?

    Brian

-- 
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/mpir-devel?hl=en.

Reply via email to