Definition of int64_t(int64_t 的定义)
问题描述
我是 C/C++ 新手,所以我有几个关于基本类型的问题:
I am new to C/C++, so I have a couple of questions about a basic type:
a) 你能解释一下 int64_t
和 long
(long int
) 的区别吗?据我了解,两者都是 64 位整数.有什么理由选择其中一个吗?
a) Can you explain to me the difference between int64_t
and long
(long int
)?
In my understanding, both are 64 bit integers. Is there any reason to choose one over the other?
b) 我试图在网上查找 int64_t
的定义,但没有成功.有没有我需要咨询这些问题的权威来源?
b) I tried to look up the definition of int64_t
on the web, without much success. Is there an authoritative source I need to consult for such questions?
c) 对于使用 int64_t
编译的代码,我目前包括
,这对我来说没有多大意义.是否有其他包含提供 int64_t
的声明?
c) For code using int64_t
to compile, I am currently including <iostream>
, which doesn't make much sense to me. Are there other includes that provide a declaration of int64_t
?
推荐答案
a) 你能解释一下
int64_t
和long
(long int
) 的区别吗?据我了解,两者都是 64 位整数.有什么理由选择其中一个吗?
a) Can you explain to me the difference between
int64_t
andlong
(long int
)? In my understanding, both are 64 bit integers. Is there any reason to choose one over the other?
前者是有符号整数类型,正好 64 位.后者是至少 32 位的有符号整数类型.
The former is a signed integer type with exactly 64 bits. The latter is a signed integer type with at least 32 bits.
b) 我试图在网上查找 int64_t
的定义,但没有成功.有没有我需要咨询这些问题的权威来源?
b) I tried to look up the definition of
int64_t
on the web, without much success. Is there an authoritative source I need to consult for such questions?
http://cppreference.com 在这里介绍:http://en.cppreference.com/w/cpp/types/integer.然而,权威来源是 C++ 标准(这个特定的位可以在 §18.4 整数类型 [cstdint] 中找到).
http://cppreference.com covers this here: http://en.cppreference.com/w/cpp/types/integer. The authoritative source, however, is the C++ standard (this particular bit can be found in §18.4 Integer types [cstdint]).
c) 对于使用 int64_t
编译的代码,我包括
,这对我来说没有多大意义.是否有其他包含提供 int64_t
的声明?
c) For code using
int64_t
to compile, I am including<iostream>
, which doesn't make much sense to me. Are there other includes that provide a declaration ofint64_t
?
在
或 std
下)或 中声明.stdint.h>
或 <inttypes.h>
(在全局命名空间中).
It is declared in <cstdint>
or <cinttypes>
(under namespace std
), or in <stdint.h>
or <inttypes.h>
(in the global namespace).
这篇关于int64_t 的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:int64_t 的定义
基础教程推荐
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 从 std::cin 读取密码 2021-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07