Liste des Groupes | Revenir à cl c |
I had thought that the standard required support for constants of
extended integer types wider than int, but the wording seems
ambiguous at best.
>
An unsuffixed decimal constant, for example, has a type that is
the first of int, long int, long long int in which its value can
be represented. But:
>
If an integer constant cannot be represented by any type in
its list, it may have an extended integer type, if the
extended integer type can represent its value. If all of the
types in the list for the constant are signed, the extended
integer type shall be signed. If all of the types in the list
for the constant are unsigned, the extended integer type shall
be unsigned. If the list contains both signed and unsigned
types, the extended integer type may be signed or unsigned.
If an integer constant cannot be represented by any type in
its list and has no extended integer type, then the integer
constant has no type.
>
The word "may" in that first sentence seems problematic. It
implies a choice: either a decimal integer constant with a value
of LLONG_MAX+1 is of an extended integer type, or it isn't. One
possible interpretation is that such a constant must be of an
extended integer type if an appropriate type exists. Another is
that it may or may not be of an extended integer type at the whim
of the implementation -- but the standard doesn't say that the
choice is either implementation-defined or unspecified. It just
says "may".
Les messages affichés proviennent d'usenet.