[Top][All Lists]

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

Re: Linux, autoconf 2.52: inttypes.h incompatibility with iostream [#506

From: Paul Eggert
Subject: Re: Linux, autoconf 2.52: inttypes.h incompatibility with iostream [#5060]
Date: Thu, 6 Dec 2001 10:12:47 -0800 (PST)

> From: Keith Bostic <address@hidden>
> Date: Thu, 6 Dec 2001 09:59:23 -0500 (EST)
> What is going on is that compiling with optimization turns on inlining
> via a preprocess macro __USE_EXTERN_INLINES, and the inlined code in
> inttypes.h is incompatible with wchar.h, which is being included via
> iostream.

Is this a known glibc bug?  If not, could you please report it?

> My only idea at the moment is to change autoconf's default includes
> to stop using inttypes.h at all, but that's pretty ugly.

Yes.  It's also heading in the wrong direction, as inttypes.h is the

Let's try to reproduce the problem in the C language only.
Do you get the same problem with this program?

   #include <inttypes.h>
   #include <wchar.h>

How about this program?

   #include <wchar.h>
   #include <inttypes.h>

Do you get the same problem with the above two programs if you
substitute stdint.h for inttypes.h?

Here's an idea for fixing things.  Very early in 'configure' you check
for the problem, and if so, you inform autoconf that there is no

Perhaps we should fix this within Autoconf, by modifying Autoconf by
adding wchar.h to the standard headers, and check for it before
checking for inttypes.h (as wchar.h is the more senior include file).
That would be an easy change to make.  But I'd like to know the
answers to the above questions before advocating such a change.

PS.  By the way, I'd like to know why you're using u_int32_t instead
of uint32_t.  C99 specifies uint32_t, and I think in the long run
you'd be better off using the standard name rather than using other

The correct way to write portable uint32_t code in C99 is something
like this:

    #include <stdint.h> /* or <inttypes.h>; either will do */
    #ifdef UINT32_MAX
     code that uses uint32_t
     This platform has no unsigned type that is exactly 32-bits wide.

However, it sounds like you're not interested in porting to platforms
lacking 32-bit ints, so in C99 you merely need to include <stdint.h>
or <inttypes.h>.

Of course you have to port to pre-C99 platforms.  So instead of merely
including a standard header, you need something like this:

     #include <config.h>
     # include <inttypes.h>
     # if HAVE_STDINT_H
     #  include <stdint.h>
     # endif

(once we get Autoconf fixed of course :-).

reply via email to

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