PRId64的正确用法

#include

#include

#include

// 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;

}

你可能感兴趣的:(PRId64的正确用法)