mikejsavage.co.uk • About • Archive • RSS • Thanks for blocking ads! Blocking ads owns: AdGuard for Safari / uBlock Origin for everything else
This code (or similar) compiles and runs with every compiler I tested but one:
#define A( x ) 1
int main() {
return A(); // -> "return 1;"
}
You can even use x
in the macro body and it's fine:
#define A( x ) x + 1
int main() {
return A(); // -> "return + 1;`
}
The only compiler that does the right thing and rejects this (if the spec says this is ok then the spec is fucked) is of course the AMD shader compiler.