3 ms·
Kind of sort of. The catch here is that because runtime is compile time with Perl, it's not exactly the same. Looking at the code, it's kind of like having some
by dhosek 5y ago
Kind of sort of. The catch here is that because runtime is compile time with Perl, it's not exactly the same. Looking at the code, it's kind of like having something like
#if (some C preprocessor expression that's true on Fridays
printf("Hello world!);
#else
printf;
#fi
(although it's been long enough since I've written C that I don't know if (a) there exists a C-preprocessor instruction as per the above, (2) if the compiler will notice errors in the unexecuted branch of an #if and (iii) if printf; would give a syntax error).
Another equivalent piece of code could be something along the lines of the JS
if (today_is_friday()) {
eval("2+2")
}
else {
eval("--2abc")
}
- garaetjjte 5y ago>(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).
- nousermane 5y ago> you could cause mayhem with __DATE__ It takes some patience, but people do try: https://stackoverflow.com/questions/11697820#16472369 https://stackoverflow.com/questions/11697820#16472369
- deleted 5y ago[deleted]