Question: Is there a 64 bit type that in every OS(32/64 bit) and for every compiler has a size of 64?

The same question is also for 32 bit type. (It should be int?)

*The origin of the question is* : I am implementing the system which has 2 kinds of instructions :

1. 32 bit
2. 64 bit

I want to write something like:

```
typedef int instruction32bit;

typedef long long instruction64bit //it is not correct some system have sizeof(long long) = 128 

```

Answer: 
If you want your code to be truly portable, then you probably want to typedef your own type, and use for example 

```
   typedef int32_t instruction32bit;
   typedef int64_t instruction64bit;

```

This will work MOST of the time, but if it doesn't for a particular system/compiler/whatever, you can add do something like this:

```
 #ifdef SOMEDEFINE
   typedef long long int instruction64bit;
   typedef int instruction32bit;
 #else
   typedef int32_t instruction32bit;
   typedef int64_t instruction64bit;
 #endif

```

Of course, for each model of compiler/OS (or group thereof) that doesn't support int32\_t and int64\_t, you probably will need a special `#ifdef`. 

This is exactly what all truly portable code does, because no matter how much you find that "nearly all compilers do X", if you get your code popular enough, there's always someone who wants to compile the code with "Bob's Compiler Project" which doesn't have this feature. Of course, the other thing is to just leat those who use "Bob's compiler" edit the typedef itself, and not accept the "For Bob's compiler, you need this ..." patch that inevitably gets sent your way. 

As Carl Norum points out in a comment, the `#ifdef` may be possible to convert to a `#if` in many cases, and then use generic types such as `int` and `long`.
Use `uint_least32_t` and `uint_least64_t`. The fixed-size types `uint32_t` and `uint64_t` will not exist on systems that don't have the exact sizes they describe.