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_tandlong(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_ton 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_tto 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 的定义
基础教程推荐
- 提升 ASIO 流缓冲 2021-01-01
- 随机插入/删除的综合向量与链表基准 2022-01-01
- c++ STL设置差异 2022-01-01
- C++:获取传递给函数的多维数组的行大小 2021-01-01
- 与 CAS 的原子交换(使用 gcc 同步内置函数) 2022-01-01
- 如何部分禁用 cmake C/C++ 自定义编译器检查 2021-01-01
- 为什么我们不能使用“虚拟继承"?在 COM 中? 2022-01-01
- 如何在 C++ 中正确使用命名空间? 2022-01-01
- 如何更改 SysDateTimePick32 或 CDateTimeCtrl 的背景颜色? 2022-01-01
- 将不可复制的闭包对象传递给 std::function 参数 2021-01-01
