when endianess does matter – cast operations [duplicate]-Collection of common programming errors

Don’t forget that the compiler will only write assembly code. If you ignore all the warnings that the compiler, you can examine the assembly code produced by the compiler and figure out what really happens.

I took this simple program:

#include 

int main()
{
    unsigned endian[2] = { 0, 0 } ;
    long * casted_endian = reinterpret_cast( endian );
    std::cout

Originally posted 2013-11-09 19:44:15.