是“长的” =“long long int” =“long int long” =“int long long”? [英] Is "long long" = "long long int" = "long int long" = "int long long"?

查看:381
本文介绍了是“长的” =“long long int” =“long int long” =“int long long”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 long int long int long long 可以编译变量类型。在 long int long int long long long long long long int

I found both long int long and int long long can compile for a variable type. Is there any difference between long int long, int long long , long long and long long int?

一般来说,如果类型相同 long

In general, is the type identical if it has the same number of 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;

此外,如果上述是正确的,以下声明是否也相同?

Also if above is right, are the following declarations also identical?

long long* llp;
int long long* illp;
long int long* lilp;
long long int* llip;


推荐答案

根据C ++标准


3当允许多个简单类型说明符时,可以自由地将
与其他声明说明符混合

3 When multiple simple-type-specifiers are allowed, they can be freely intermixed with other decl-specifiers in any order.

例如下面的声明是有效的

So for example the following declaration is valid

long static long const int x = 10;

您甚至可以使用 constexpr const 限定符。例如

You may even use constexpr specifier along with const qualifier. For example

constexpr long static long const int x = 10;

顺便说一下,我们忘了指定者 signed !让我们添加它例如在声明之前 x

By the way, we forgot about specifier signed! Let's add it for example before declarator x

constexpr long static long const int signed x = 10;

在C中,您还可以在同一声明说明符序列中使用几个类型限定符。根据C标准(6.7.3类型限定符)

In C you may also use several type qualifiers in the same declare specifier sequence. According to the C Standard (6.7.3 Type qualifiers)


5如果相同的限定符在同一个
中出现多次直接或通过一个或多个typedef,
的行为是一样的,如果它只出现一次....

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中,以下声明也是有效的

So for example in C the following declaration is also valid

const long const long static const int const signed x = 10;

因此,如果您根据程序中键入的符号数付款,这样的声明。 :)

So if you are paid according to the number of symbols typed in the program then I advise you to use such declarations. :)

这篇关于是“长的” =“long long int” =“long int long” =“int long long”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆