This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stdint.h


Guys,

On Sep 20 00:25, Christopher Faylor wrote:
> On Tue, Sep 20, 2005 at 04:47:27AM +0200, Ralf Corsepius wrote:
> >On Mon, 2005-09-19 at 22:11 -0400, Christopher Faylor wrote:
> >>I really don't see any need to use the RTEMS stuff especially given the
> >>"it's not broke" principle.
> >
> >Well, the RTEMS stdint.h/inttypes.h aren't specific to RTEMS.
> 
> Again, since there is nothing wrong with the present cygwin
> implementation, there is no reason to change what we have.

First, Jeff, would you mind to wait a few hours before changing stuff
which affects all targets like that?  The whole process of checkin plus
discussion took place in one single night from my timezone's point of view.

I was going to be a bit more relaxed about this issue than Chris, so
I created a thorough testcase to check how this affects Cygwin.  The
attached, very simple testcase builds and runs fine using Cygwin's
stdint.h/inttypes.h.  FWIW, the same testcase runs fine on Linux with
glibc.

However, it doesn't even build when using RTMES stdint.h/inttypes.h,
so I don't think the RTEMS stdint.h was ready for prime time:

- All *fast* typedefs are missing (int_fast8_t, etc.) and all
  *FAST* definitions (INT_FAST8_MIN, etc.) are missing.

   This is marked as "todo" in the header comment.

- A couple of disturbing warnings about INT32_MIN, INT64_MIN, INT64_MAX
  and the corresponding unsigned defnitions:

   INT32_MIN:  warning: this decimal constant is unsigned only in ISO C90
   INT64_MIN:  integer constant is so large that it is unsigned
               this decimal constant is unsigned only in ISO C90
   INT64_MAX:  integer constant is too large for "long" type
   UINT32_MAX: warning: this decimal constant is unsigned only in ISO C90
   UINT64_MAX: warning: integer constant is so large that it is unsigned
               warning: this decimal constant is unsigned only in ISO C90
	       warning: integer constant is too large for "long" type

  When uncommenting every other problem in the file, there's also a bug
  in evaluating the INT32*_MIN values:

    INT32_MIN, INTLEAST32_MIN are printed as the positive value
    2147483648, not -2147483648.

- All *LEAST* definitions are incorrect because RTEMS' stdint.h defines
  them omitting an underscore after the type:

    RTEMS:  INTLEAST8_MIN
    SUSv3:  INT_LEAST8_MIN

- All INTPTR* definitions are missing (INTPTR_MIN, INTPTR_MAX, UINTPTR_MAX).

- All INTMAX* definitions are missing (INTMAX_MIN, INTMAX_MAX, UINTMAX_MAX).

- The condition, when to include limits.h and when not to include it,
  seems not to be foolproof.  I get these error message as well, unless
  I manually include limits.h prior to including inttypes.h:

    stdint-test.c:296: error: `LONG_MAX' undeclared here (not in a function)
    stdint-test.c:299: error: `INT_MAX' undeclared here (not in a function)

- Definitions of PTRDIFF_MIN and PTRDIFF_MAX are missing.

- Definitions for WCHAR_MIN, WCHAR_MAX, WINT_MIN, WINT_MAX are missing.

    The missing WINT macros are marked as "todo" in the header comment.

I didn't check if all PRI* and SCN* definitions have the right value, though.


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.

Attachment: stdint-test.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]