why we require uint64_t when unsigned long is available ?

c, type-conversion, typedef

Solution

The reason should be pretty obvious; it's a guarantee that there is 64 bits of precision. There is no such guarantee for `unsigned long`.

The fact that on your system it's a `typedef`, just means that on your system `unsigned long` is 64 bits. That's not true in general, but the `typedef` can be varied (by the compiler implementors) to make the guarantee for `uint64_t`.

Problem

I just wanted to know, Why we need to have `uint64_t` which is actually a `typedef of unsigned long` , when unsigned long is anyway available. Is it only for make the name short or any other reason ?

Original source

Related problems