PRId64的正确用法

来源:互联网 发布:看高清电视直播的软件 编辑:程序博客网 时间:2024/04/28 00:43
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>


// g++ -g -o x x.cpp -D__STDC_FORMAT_MACROS -std=c++11
int main()
{
        int64_t a = 32;
        //printf("%"PRId64"\n", a);
        printf("%" PRId64"\n", a); // 在PRId64前保留一个空格
        // 如果不保留空格,则C++11编译时将报如下警告:
        // invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
        // 将PRId64换成其它宏,情况相同
        return 0;
}
0 0