在 64 位数据模型上指定 64 位无符号整数文字 [英] Specifying 64-bit unsigned integer literals on 64-bit data models

查看:25
本文介绍了在 64 位数据模型上指定 64 位无符号整数文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于 64 位数据模型有多种类型(LLP64/IL32P64、LP64/I32LP64、ILP64、SILP64),那么指定 64 位无符号整数文字的标准符合方式是什么?

As there are various types of 64-bit data models (LLP64/IL32P64, LP64/I32LP64, ILP64, SILP64), what is the standard conforming way of specifying 64-bit unsigned integer literals?

指定 ULL 的后缀就足够了吗?或者我最终会导致文字在某些数据模型上被解释为 128 位?

Would specifying the suffix of ULL be sufficient? Or would I end up causing the literal to be interpreted as 128-bit on some data models?

推荐答案

你应该使用 <cstdint>/,如果你有的话.这会给你:

You should use <cstdint> / <stdint.h>, if you have it. This will give you:

  • uint64_t 是一个无符号整数类型,大小为 64 位
  • UINT64_C() 是一个宏,用于创建 uint64_t 类型的常量,方法是让宏附加正确的后缀.
  • uint64_t is an unsigned integer type which is 64 bits in size
  • UINT64_C() is a macro for creating constants of the type uint64_t, by having the macro append the proper suffix.

这篇关于在 64 位数据模型上指定 64 位无符号整数文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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