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 的定义
 
				
         
 
            
        - 使用/clr 时出现 LNK2022 错误 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 从python回调到c++的选项 2022-11-16
- 静态初始化顺序失败 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- C++ 协变模板 2021-01-01
- 近似搜索的工作原理 2021-01-01
- Stroustrup 的 Simple_window.h 2022-01-01
 
						 
						 
						 
						 
						 
				 
				 
				 
				