#include <iostream> // The CPU bytes order enum TCPUArch {LITTLE_ENDIAN, BIG_ENDIAN, NONEIEEE}; int main(int argc, char *argv[]) { using namespace std; TCPUArch architecture; union { double f; unsigned int x[2]; } testcpu; testcpu.f = 1.0; if( testcpu.x[1] == 0x3FF00000 ) architecture = LITTLE_ENDIAN; else if( testcpu.x[0] == 0x3FF00000 ) architecture = BIG_ENDIAN; else architecture = NONEIEEE; cout << architecture << endl; return 0; } Power PC的朋友试一下看看是否是BIG ENDIAN?