Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The difference between unsigned long and UINT64

Tags:

c++

c

windows

What is the difference between unsigned long and UINT64? I think they are the same, but I'm not sure. The definition of UINT64 is :

typedef unsigned __int64    UINT64

(by using StdAfx.h)

like image 238
Liran Avatar asked Jun 23 '10 07:06

Liran


People also ask

Is UInt64 a long long?

h> header) defines uint64_t as unsigned long long , because unsigned long isn't wide enough. In 64-bit mode, it defines uint64_t as unsigned long . It could have defined it as unsigned long long in both modes. The choice is arbitrary; all that's required is that it has to be a 64-bit type.

What is a UInt64?

The UInt64 value type represents unsigned integers with values ranging from 0 to 18,446,744,073,709,551,615. Important. The UInt64 type is not CLS-compliant. The CLS-compliant alternative type is Decimal. Int64 can be used instead to replace a UInt64 value that ranges from zero to MaxValue.

Is uint64_t same as unsigned long long?

A unsigned long long int is not standardised across all systems so the size can change depending on the system running the code. A uint64_t is standardised in c++ and guarantees 64bits of storage, you need to include stdint. h to use it though.

What is the difference between UInt64 and Int64?

Int64 is used to represents 64-bit signed integers . UInt64 is used to represent 64-bit unsigned integers.


1 Answers

UINT64 is specific and declares your intent. You want a type that is an unsigned integer that is exactly 64 bits wide. That this may be equal to an unsigned long on some platforms is coincidence.

like image 158
Jason Coco Avatar answered Sep 25 '22 04:09

Jason Coco