Qt 类型的限制在哪里?

发布于 2024-10-13 11:04:15 字数 125 浏览 0 评论 0原文

通常,我可以参考 limit.h 来查看某种类型(例如 int 或 long)的最大值是多少。

在Qt中,有像qlonglong这样的类型。是否有头文件和/或文档可以以类似的方式使用来手动或以编程方式引用这些类型的限制?

Regularly, I could reference limits.h to see what the max is for a certain type, like an int or long.

In Qt, there are types like qlonglong. Is there a header file and/or documentation that can be used in a similar way to manually or programmatically reference the limits of these types?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

池木 2024-10-20 11:04:15

Qt 类型很可能会分解为定义了 numeric_limits 的基本类型之一。您是否尝试过调用例如 std::numeric_limits::max()

正如 MSalters 也指出的那样,如果类型不是内置的,numeric_limits 仍然可以专门用于它们。如果是这样的话,人们会希望 Qt 能够包含它们。

There's a high likelihood the Qt types distill down to one of the basic types for which numeric_limits are defined. Have you tried calling e.g., std::numeric_limits<qlonglong>::max()?

As MSalters points out, too, if the types are not builtin numeric_limits can still be specialized for them. If that were the case one would hope Qt would include them.

彼岸花ソ最美的依靠 2024-10-20 11:04:15

查看 QtGlobal 文档。

对于一些不明显的:
qlonglong - 64 位
qptrdiff - 32 位或 64 位,具体取决于平台
qreal - 双精度(ARM 架构上的浮点数)
quintptr - 无符号 32 位或 64 位,具体取决于平台
qulonglong - 无符号 64 位
ucharuintulongushort - 无符号类型的便捷简写

Take a look at the QtGlobal documentation.

For some of the non-obvious ones:
qlonglong - 64-bit
qptrdiff - 32-bit or 64-bit depending on platform
qreal - double (float on ARM architectures)
quintptr - unsigned 32-bit or 64-bit depending on platform
qulonglong - unsigned 64-bit
uchar, uint, ulong, ushort - convenience shorthand for unsigned types

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文