Re:Perl code that is syntactically correct only on Fridays
by garaetjjte on Wednesday February 16, 2022 @11:38AM
(#30362159)
>(a) there exists a C-preprocessor instruction as per the above
There's no day-of-week but you could cause mayhem with __DATE__
>(2) if the compiler will notice errors in the unexecuted branch of an #if
Compiler only gets to see preprocessor output, it won't.
>if printf; would give a syntax error
Perhaps surprisingly but no, it's just statement without effect (containing expression returning function pointer to printf).
Re:Perl code that is syntactically correct only on Fridays
by nousermane on Wednesday February 16, 2022 @11:47AM
(#30362273)
> you could cause mayhem with __DATE__
It takes some patience, but people do try: https://stackoverflow.com/questions/11697820#16472369
Another equivalent piece of code could be something along the lines of the JS