Is it possible to redefine a c++ keyword using #define?
#ifdef int
#undef int
#define int 2
#endif
int main(){
//Do something with int
}
I
Technically it works but it probably won't do you much good. If you want to use the standard C++ library you are not allowed define any of the keywords or any of a set of other names according to 17.6.4.3.1 [macro.names] paragraph 2:
A translation unit shall not #define or #undef names lexically identical to keywords, to the identifiers listed in Table 3, or to the attribute-tokens described in 7.6.