对于使用intptr_t和uintptr_t字符串格式 [英] string format for intptr_t and uintptr_t
本文介绍了对于使用intptr_t和uintptr_t字符串格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是字符串格式使用intptr_t
和 uintptr_t形式
有效期为32位和64位架构。
修改
警告:格式'%X'需要键入无符号整型,但参数2的类型为AAA
这是我在64位,但不是在32位得到警告。
使用intptr_t AAA
解决方案
这是从下面的宏inttypes.h
:
有关的printf
: PRIdPTR PRIiPTR PRIoPTR PRIuPTR PRIxPTR PRIXPTR
有关 scanf函数
: SCNdPTR SCNiPTR SCNoPTR SCNuPTR SCNxPTR
What is the string format for intptr_t
and uintptr_t
which is valid for both the 32 and 64 bit architecture .
EDIT
warning: format ‘%x’ expects type ‘unsigned int’, but argument 2 has type "AAA"
This is the warning i am getting in 64 bit but not in 32 bit.
intptr_t AAA
解决方案
That would be the following macros from inttypes.h
:
For printf
:
PRIdPTR PRIiPTR PRIoPTR PRIuPTR PRIxPTR PRIXPTR
For scanf
:
SCNdPTR SCNiPTR SCNoPTR SCNuPTR SCNxPTR
这篇关于对于使用intptr_t和uintptr_t字符串格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文