]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. index:: long long data types, double-word arithmetic, multiprecision arithmetic, LL integer suffix, ULL integer suffix | |
7 | ||
8 | .. _long-long: | |
9 | ||
10 | Double-Word Integers | |
11 | ******************** | |
12 | ||
13 | ISO C99 and ISO C++11 support data types for integers that are at least | |
14 | 64 bits wide, and as an extension GCC supports them in C90 and C++98 modes. | |
15 | Simply write ``long long int`` for a signed integer, or | |
16 | ``unsigned long long int`` for an unsigned integer. To make an | |
17 | integer constant of type ``long long int``, add the suffix :samp:`LL` | |
18 | to the integer. To make an integer constant of type ``unsigned long | |
19 | long int``, add the suffix :samp:`ULL` to the integer. | |
20 | ||
21 | You can use these types in arithmetic like any other integer types. | |
22 | Addition, subtraction, and bitwise boolean operations on these types | |
23 | are open-coded on all types of machines. Multiplication is open-coded | |
24 | if the machine supports a fullword-to-doubleword widening multiply | |
25 | instruction. Division and shifts are open-coded only on machines that | |
26 | provide special support. The operations that are not open-coded use | |
27 | special library routines that come with GCC. | |
28 | ||
29 | There may be pitfalls when you use ``long long`` types for function | |
30 | arguments without function prototypes. If a function | |
31 | expects type ``int`` for its argument, and you pass a value of type | |
32 | ``long long int``, confusion results because the caller and the | |
33 | subroutine disagree about the number of bytes for the argument. | |
34 | Likewise, if the function expects ``long long int`` and you pass | |
3ed1b4ce | 35 | ``int``. The best way to avoid such problems is to use prototypes. |