#include <iostream>
using namespace std;
static union
{
int i;
char c[sizeof(int)];
}Host1={1};
//c[0]为1则是小端,为0为大端;目前x86系统低位地址存放数据地数据位,因此C[0]为1;
#if Host1.c[0]==0
#define BIGENDIANNESS 1
#else
#define BIGENDIANNESS 0
#endif
int main()
{
int b = BIGENDIANNESS;
cout<<"Is BigEndianness"<<b<<"\n";
return 0;
}
using namespace std;
static union
{
int i;
char c[sizeof(int)];
}Host1={1};
//c[0]为1则是小端,为0为大端;目前x86系统低位地址存放数据地数据位,因此C[0]为1;
#if Host1.c[0]==0
#define BIGENDIANNESS 1
#else
#define BIGENDIANNESS 0
#endif
int main()
{
int b = BIGENDIANNESS;
cout<<"Is BigEndianness"<<b<<"\n";
return 0;
}