gia na anapsoyn ligo ta aimata :-)

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Nov 11 08:36:25 EET 2005


On 2005-11-10 11:40, Giannis Papadopoulos <ipapadop at inf.uth.gr> wrote:
>Giorgos Keramidas wrote:
>> Μη βιάζεσαι όμως... είναι μια πολύ μικρή διαφορά που έχει η C99
>> από τη C89, και θέλει λίγο προσοχή για να την ψυλιαστείς :)
>
> Αν και δεν έχω πρόχειρο το standard της C99, μάλλον τα integer literals
> είναι unsigned στην ISO C90 (όπως πολύ καλά μας λέει ο ευγενής gcc
>
> koko.c:9: warning: this decimal constant is unsigned only in ISO C90

Ακριβώς!

Το C99 standard λέει (παράγραφος 6.4.4.5, "Integer constants"):

#   5 The type of an integer constant is the first of the corresponding
#     list in which its value can be represented.
#
#     +-------------+------------------------+------------------------+
#     |             |                        |   Octal or Hexadecimal |
#     |Suffix       |      Decimal Constant  |           Constant     |
#     +-------------+------------------------+------------------------+
#     |none         | int                    | int                    |
#     |             | long int               | unsigned int           |
#     |             | long long int          | long int               |
#     |             |                        | unsigned long int      |
#     |             |                        | long long int          |
#     |             |                        | unsigned long long int |
#     +-------------+------------------------+------------------------+
#     |u or U       | unsigned int           | unsigned int           |
#     |             | unsigned long int      | unsigned long int      |
#     |             | unsigned long long int | unsigned long long int |
#     +-------------+------------------------+------------------------+
#     |l or L       | long int               | long int               |
#     |             | long long int          | unsigned long int      |
#     |             |                        | long long int          |
#     |             |                        | unsigned long long int |
#     +-------------+------------------------+------------------------+
#     |Both u or U  | unsigned long int      | unsigned long int      |
#     |and l or L   | unsigned long long int | unsigned long long int |
#     |ll or LL     | long long int          | long long int          |
#     |             |                        | unsigned long long int |
#     +-------------+------------------------+------------------------+
#     |Both u or U  | unsigned long long int | unsigned long long int |
#     |and ll or LL |                        |                        |
#     +-------------+------------------------+------------------------+

Αντίθετα, στη C89, όλα τα decimal constants είναι unsigned.

Γιάννη, μπορείς όποτε θες να μου πεις (με προσωπικό email) που να στείλω
το κέρασμα.  Αμέσως μόλις γυρίσω στα πάτρια εδάφη, είναι δικό σου :)

- Γιώργος




More information about the Linux-greek-users mailing list