#pragma push_macro(" ")
...
# undef ..
# pragma pop_macro(" ")
将宏定义 go 压入栈
取消它的定义(go 本来含义便获得了恢复)
将宏定义 go 弹出栈,恢复宏定义
#include <iostream>

#define double float
using namespace std;


int main() {
    double a = 1.5688958778877;
    cout << sizeof(a) << endl;
    #pragma push_macro("double")
    #undef double
        double b = 1.5688958778877;
        cout << sizeof(b) <<endl;
    #pragma pop_macro("double")
    double c =1.5688958778877;
    cout << sizeof(c) <<endl;
    return 0;
}
4
8
4

标签: none

添加新评论