Possible Duplicate:
“long int”, “long long” Data Types
I am a newbie of C++ and I looked at a sample code and I saw long long type.
It says something like this
long long deviceId;
Is this same as long type? I am trying to send a device id from java(Android) to my server. In java, device id is long type(8byte) and I am putting this into the buffer like
bytebuffer.putLong(Long.valueOf(deviceId));
I am trying to parse this on my linux server using c++.
Thanks in advance.
long longis not the same aslong(although they can have the same size, e.g. in most 64-bit POSIX system). It is just guaranteed that along longis at least as long as along. In most platforms, along longrepresents a 64-bit signed integer type.You could use
long longto store the 8-byte value safely in most conventional platforms, but it’s better to useint64_t/int_least64_tfrom<stdint.h>/<cstdint>to clarify that you want an integer type having ≥64-bit.