This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: I would like to help implement stdint.h
- From: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- To: Jason Catena <jason at jcatena dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 11 Oct 2003 11:11:35 +0100 (BST)
- Subject: Re: I would like to help implement stdint.h
- References: <200310110135.h9B1Z1bX023643@jcatena.net>
On Fri, 10 Oct 2003, Jason Catena wrote:
> Since stdint.h is platform-dependent, I was thinking of writing a
> small program that would translate a description of the type sizes on
> the target to a finished stdint.h file. Alternately, I could create a
> library of stdint.h files, but it seems more efficient and flexible to
> create it in the fly.
The current thinking is that you should follow the same approach now used
for <limits.h> and <float.h> - that is, have a single stdint.h file that
uses macros predefined by the compiler to determine the types involved.
Because many targets can have their type sizes changed at compiler runtime
with -m options, generating a <stdint.h> file at compiler build time isn't
a feasible approach.
There will need to be sensible defaults for the types, as well as target
macros to override them. A fair amount of work will be involved in going
through supported targets which have their own <stdint.h>, such as all
glibc-based targets, to ensure that GCC's types agree with those systems'
types. This is also necessary on systems which have <inttypes.h> but not
<stdint.h> (such as Solaris). Note that GCC will also need to gain an
awareness of sig_atomic_t, which it previously hasn't needed to know about
(and some embedded targets may not have at all; see DR#248).
<stdint.h> may also need to be compatible with what various systems' other
headers expect of it or of <inttypes.h> (try to make something more
comprehensible than GCC's <stddef.h>).
Some fixincludes work may also be needed to make existing system headers
work well with GCC's <stdint.h>, especially on systems which have
<inttypes.h> only.
--
Joseph S. Myers
jsm@polyomino.org.uk