Using C compiler, how to set int word length to be the same as system word length

  c++, question

For example, when dealing with the problem: “How to get the word length of the system without using sizeof () and C program?”

Even on 64-bit computers, used C compilers compile int into 32 bits. So how do I set it in C so that the int compiler word length is the same as the system word length?

Compiled with GCC on Linux, the long for 32-bit computers is 4 bytes and the long for 64-bit computers is 8 bytes.

I searched macro on VS.INT_MAXThe definition of, seems to be only one place, is2147483647, so there should be no way to set it, can only define a type.

And I learned that usually some projects do not directly use the default type, but redefine a set of types to use, for example, I can define a set of types like this:

#ifdef m32
 typedef int SpacelanInt;
 typedef float SpacelanFloat;
 #else
 typedef long int SpacelanInt;
 typedef double SpacelanFloat;
 #endif