您的位置:首页 > 其它

long long data type in GCC and what's the meaning of 1LL

2007-01-25 15:47 597 查看
ISO C99 supports data types for integers that are at least 64 bits wide, and as an extension GCC supports them in C89 mode and in C++. Simply write
long long int
for a signed integer, or
unsigned long long int
for an unsigned integer. To make an integer constant of type
long long int
, add the suffix `LL' to the integer. To make an integer constant of type
unsigned long long int
, add the suffix `ULL' to the integer.

You can use these types in arithmetic like any other integer types. Addition, subtraction, and bitwise boolean operations on these types are open-coded on all types of machines. Multiplication is open-coded if the machine supports fullword-to-doubleword a widening multiply instruction. Division and shifts are open-coded only on machines that provide special support. The operations that are not open-coded use special library routines that come with GCC.

There may be pitfalls when you use
long long
types for function arguments, unless you declare function prototypes. If a function expects type
int
for its argument, and you pass a value of type
long long int
, confusion will result because the caller and the subroutine will disagree about the number of bytes for the argument. Likewise, if the function expects
long long int
and you pass
int
. The best way to avoid such problems is to use prototypes.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐