« Programmation C/Types de base » : différence entre les versions
Contenu supprimé Contenu ajouté
un int est codé sur 32 bits sur toutes les machines en 2018 |
Il faut conserver une cohérence entre les tableaux. Une note sur l'évolution des machines pourrait suffire à se prémunir du passé et futur. Annulation des modifications 595328 de 2A01:E35:8AE7:B4B0:9915:3347:38DC:4089 (discussion) Balise : Annulation |
||
Ligne 63 :
|-----
| bgcolor="#F9F9F9" |<code>int</code>
| ≥ 16 bits
| style="background-color:#FFFFFF; text-align: right;" |{{formatnum:-32768}}
| style="background-color:#FFFFFF; text-align: right;" | -(2<sup>15</sup>)
| style="background-color:#FFFFFF; text-align: right;" |{{formatnum:+32767}}
| style="background-color:#FFFFFF; text-align: right;" |2<sup>15</sup>-1
|-
| bgcolor="#F9F9F9" |<code>unsigned int</code>
| ≥ 16 bits
| style="background-color:#FFFFFF; text-align: right;" |0
| style="background-color:#FFFFFF; text-align: right;" |0
| style="background-color:#FFFFFF; text-align: right;" |{{formatnum:+65535}}
| style="background-color:#FFFFFF; text-align: right;" |2<sup>16</sup>-1
|-----
| bgcolor="#F9F9F9" |<code>long</code>
| ≥ 32 bits
| style="background-color:#FFFFFF; text-align: right;" |
| style="background-color:#FFFFFF; text-align: right;" | -(2<sup>31</sup>)
| style="background-color:#FFFFFF; text-align: right;" |{{formatnum:+2147483647}}
| style="background-color:#FFFFFF; text-align: right;" |2<sup>31</sup>-1
|-
| bgcolor="#F9F9F9" |<code>unsigned
| ≥ 32 bits
| style="background-color:#FFFFFF; text-align: right;" |0
Ligne 76 ⟶ 90 :
| style="background-color:#FFFFFF; text-align: right;" |2<sup>32</sup>-1
|-----
| bgcolor="#F9F9F9" |<code>long long</code> ''(C99)''
| ≥ 64 bits
| style="background-color:#FFFFFF; text-align: right;" |{{formatnum:-9223372036854775807}}
Ligne 83 ⟶ 97 :
| style="background-color:#FFFFFF; text-align: right;" |2<sup>63</sup>-1
|-
| bgcolor="#F9F9F9" |<code>unsigned
| ≥ 64 bits
| style="background-color:#FFFFFF; text-align: right;" |0
Ligne 91 ⟶ 105 :
|}
Cette table signifie qu'un programme peut utiliser sans problème une variable de type <code>int</code> pour stocker la valeur 2<sup>
Par contre, une implémentation C <em>peut</em> fournir des domaines de valeurs plus larges que ceux indiqués au-dessus :
|