C # equivalent of 64 bit unsigned long long in C ++

I am building a DLL to be used by C ++ using COM. Please let me know what will be the C # equivalent of the C ++ 64-bit unsigned long long .

Will it be a ulong type in C #? Please confirm.

Thanks Gagan

+13
c ++ long-integer c # unsigned
source share
4 answers

Maybe this will help you:

  • ulong (64-bit unsigned integer)
  • double (64-bit floating point number).
+14
source share

For anything that goes beyond ulong , you can also use the C # BigInteger framework.

+2
source share

In C ++, each integer type doubles its size when running on a 64-bit machine, rather than on a 32-bit one.
Therefore, specifying that C # int or long can be equivalent to C ++ int or long is incorrect.

Rather, C # has a type called IntPtr that was created exclusively for P / Invoke. Indeed, this size changes its size from 4 bytes on a 32-bit machine to 8 bytes on a 64-bit machine, and therefore it is the correct equivalent of C ++ unsigned long or Windows ULONG .

0
source share

Starting with C ++ 11, you can use them:

  • int8_t
  • int16_t
  • int32_t
  • int64_t
  • uint8_t
  • uint16_t
  • uint32_t
  • uint64_t

Their size is guaranteed to remain unchanged regardless of everything.

http://en.cppreference.com/w/cpp/types/integer ,

-7
source share

All Articles