datatypes
In C/C++ datatypes are dependant on the system you are compiling for.
This can be 16 bit, 32 bit or 64 bit, and Big Endian or Little Indian.
For 64bit systems it even depends on the data model.
In Java this is all standardised.
An integer is always 32 bit and data is always Big Endian.
Also there are no unsigned types in java, all types are signed, even bytes.
This can be annoying and confusing.
The following table gives an overview for a 32bit i386 and a 64bit AMD64 system:
|
|
In C and C++, you can use char* and casts to convert simple datatypes into bytes. In java this is not possible. Luckily the java.nio package exists. This contains among things the class ByteBuffer, making data conversions alot easier.
To Be continued...!