linux macro in C


int main(void)
{ 
 int linux = 5;
 printf("%d",linux);
 return 0;
}
When u compile this application using gcc in linux, you will get compilation error, this is because linux is a macro which is defined to 1 You can look this by stopping at the preprocessing stage gcc -E test.c will stop this at the preprocessing stage.
int main(void)
{
 int 1 = 5;
 printf("%d",1);
 return 0;
}
You can see the linux is expanded to 1 in the preprocessing stage and hence the error.

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig