Hello everyone. I am doing a preliminary check to see if my system is large or cowardly. In LInux, by default it should be low-threaded, but I just wanted to double check. I used 2 approaches
- using endian forward support
- using the code i found on the internet
I used the following static statement
BOOST_STATIC_ASSERT(!BIG_ENDIAN);
which fails during compilation, so though ... mmxx ... is my system a big endian? This is the error that I have
error: invalid application of ‘sizeof’ to incomplete type
boost::STATIC_ASSERTION_FAILURE<false>’
If I run the test using some code similar to the one below, it confirms that the system has a low-drive character. Do you know what I'm doing wrong and am using Boost macro correctly?
bool is_big_endian_v3 () {
long x = 0x34333231;
char *y = (char *) &x;
if(std::strncmp(y,"1234",4)){
printf("Big Endian");
return true;
}else{
printf("Little Endian");
return false;
}
std::runtime_error ex("I cannot be here");
throw ex;
}