[GCC4TI] Début de stdint.h (ticket #21)...
Lionel Debroux
lionel_debroux at yahoo.fr
Wed Sep 24 11:22:02 CEST 2008
Salut à tous,
Est-ce que quelqu'un aurait sous la main une version finale du standard
C99, de l'époque ?
J'ai un draft du Technical Committee 2, daté du 6 May 2005, et je souhaiterais vérifier deux choses:
* ce draft définit que:
7.18.2 Limits of specified-width integer types
1 The following object-like macros specify the minimum and maximum limits of the
types declared in <stdint.h>. Each macro name corresponds to a similar type name in
7.18.1.
2 Each instance of any defined macro shall be replaced by a constant expression suitable
for use in #if preprocessing directives, and this expression shall have the same type as
would an expression that is an object of the corresponding type converted according to
the integer promotions. Its implementation-defined value shall be equal to or greater in
magnitude (absolute value) than the corresponding value given below, with the same sign,
except where stated to be exactly the given value.
7.18.2.1 Limits of exact-width integer types
1 — minimum values of exact-width signed integer types
INTN_MIN exactly −(2^(N−1) )
— maximum values of exact-width signed integer types
INTN_MAX exactly 2^(N−1) − 1
— maximum values of exact-width unsigned integer types
UINTN_MAX exactly 2^N − 1
7.18.2.2 Limits of minimum-width integer types
1 — minimum values of minimum-width signed integer types
INT_LEASTN_MIN −(2^(N−1) − 1)
— maximum values of minimum-width signed integer types
INT_LEASTN_MAX 2^(N−1) − 1
— maximum values of minimum-width unsigned integer types
UINT_LEASTN_MAX 2^N − 1
7.18.2.3 Limits of fastest minimum-width integer types
1 — minimum values of fastest minimum-width signed integer types
INT_FASTN_MIN −(2^(N−1) − 1)
— maximum values of fastest minimum-width signed integer types
INT_FASTN_MAX 2^(N−1) − 1
— maximum values of fastest minimum-width unsigned integer types
UINT_FASTN_MAX 2^N − 1
7.18.2.4 Limits of integer types capable of holding object pointers
1 — minimum value of pointer-holding signed integer type
INTPTR_MIN −(2^15 − 1)
— maximum value of pointer-holding signed integer type
INTPTR_MAX 2^15 − 1
— maximum value of pointer-holding unsigned integer type
UINTPTR_MAX 2^16 − 1
7.18.2.5 Limits of greatest-width integer types
1 — minimum value of greatest-width signed integer type
INTMAX_MIN −(2^63 − 1)
— maximum value of greatest-width signed integer type
INTMAX_MAX 2^63 − 1
— maximum value of greatest-width unsigned integer type
UINTMAX_MAX 2^64 − 1
Les valeurs concernant intptr_t et uintptr_t sont très bizarres, puisque intptr_t et uintptr_t sont censés être
7.18.1.4 Integer types capable of holding object pointers
The following type designates a signed integer type with the property that any valid
pointer to void can be converted to this type, then converted back to pointer to void,
and the result will compare equal to the original pointer:
intptr_t
The following type designates an unsigned integer type with the property that any valid
pointer to void can be converted to this type, then converted back to pointer to void,
and the result will compare equal to the original pointer:
uintptr_t
These types are optional.
Sur TI-68k, ces deux types seraient 32 bits (en fait, 24 bits, le 68000 ne gérant que 24 bits d'adresse), pas 16 bits. Ce que PpHd a du reste fait dans son stdint.h, et ça me semble beaucoup plus logique.
* les valeurs des INT_(LEAST|FAST)_MIN ne sont pas identiques aux valeurs
des INT_MIN, et INTMAX_MIN != INT64_MIN, je les ai donc corrigés par rapport à mon précédent envoi.
Ca peut très bien être une lubie de standardisation de décider que int_leastN_t ne peut pas stocker -(2^(N-1)) comme valeur valide, alors
que c'est physiquement possible...
Que dit le standard C99 de l'époque ?
Je n'ai pas encore testé le stdint.h généré par le système d'aide de TIGCC. Je ne crois pas que la suppression des espaces dans les macros
*_C(c) pose problème, mais il faut quand même vérifier...
Lionel.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stdint.h
Type: text/x-chdr
Size: 2963 bytes
Desc: not available
URL: <http://box.godzil.net/pipermail/tigccpp/attachments/20080924/b2cf241f/attachment-0002.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stdint.h
Type: text/x-chdr
Size: 3007 bytes
Desc: not available
URL: <http://box.godzil.net/pipermail/tigccpp/attachments/20080924/b2cf241f/attachment-0003.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-auto-generated-definitions-for-definitions-conta.patch
Type: text/x-diff
Size: 55827 bytes
Desc: not available
URL: <http://box.godzil.net/pipermail/tigccpp/attachments/20080924/b2cf241f/attachment-0001.bin>
More information about the Tigccpp
mailing list