我找到了long int long
和 int long long
可以编译为变量类型。 long int long
有什么区别吗, int long long
, long long
和 long long int
?
一般来说,如果类型相同,long
的数量是否相同? ?
1 长:
long l;
int long il;
long int li;
2 长:
long long ll;
int long long ill;
long int long lil;
long long int lli;
如果上面是对的,下面的声明是否也相同?
long long* llp;
int long long* illp;
long int long* lilp;
long long int* llip;
最佳答案
根据 C++ 标准(7.1.6.2 简单类型说明符)
3 When multiple simple-type-specifiers are allowed, they can be freely intermixed with other decl-specifiers in any order.
所以例如下面的声明是有效的
long static long const int x = 10;
您甚至可以将 constexpr
说明符与 const
限定符一起使用。例如
constexpr long static long const int x = 10;
顺便说一句,我们忘记了说明符 signed
!例如,让我们在声明符 x
constexpr long static long const int signed x = 10;
在 C 中,您还可以在同一个声明说明符序列中使用多个类型限定符。根据 C 标准(6.7.3 类型限定符)
5 If the same qualifier appears more than once in the same specifier-qualifier-list, either directly or via one or more typedefs, the behavior is the same as if it appeared only once....
例如在 C 中,下面的声明也是有效的
const long const long static const int const signed x = 10;
因此,如果您根据在程序中键入的符号数量获得报酬,那么我建议您使用此类声明。 :)
关于c++ - 是 "long long"= "long long int"= "long int long"= "int long long"吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30726423/