long type doubt

I cannot see in the docs the specification for the “long” type. Is that a 64-bits type, compilers dependent, C one or what? thx

Currently 32-bit integers are supported via int (and variations) type.

Note that unlike float, there is no standard size for integers in C, the size is hardware dependent.


Does this imply that, on a 64-bit host architecture, the size of a long is different in one and the same function depending on if it runs on the host or device? I guess this can result in quite interesting bugs. :)

– Kuisma

I know that nvcc generates 64-bit pointers on the device to avoid this kind of bug. I would assume it would do the same with longs.

You have to check your compiler/architecture combination for the exact handling of various integers.


CUDA longs are always the same size as longs on the host platform.