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 的定义
基础教程推荐
- CString 到 char* 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 初始化列表*参数*评估顺序 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
