I am using the -LITTLE flag for choosing little endian calculation and
-BIG for big endian calculation in my project while compiling.
#ifdef LITTLE
{
// i'm using i for operating one loop
}
#endif
/* If the system is big-endian, store bytes in array as forward order */
#ifdef BIG
{
// using i for loop
}
#endif
like
gcc -LITTLE my_c_file.c
I want to check if user hasn’t given any of flag at compile time then compilation does not takes place and give an error.
How can I do that?
I think you mean
gcc -DLITTLE.You can use something like:
At a guess, you might also want:
Of course, it’s better if you can write code that doesn’t care about the endianness of the maching that you are running on and avoid the whole mess.