5 ms·
Here's mine : $ cat test.c #include <stdio.h> int main() { int a = 3; int b = 3; // aren't we supposed to add 2 a
by Clex 12y ago
Here's mine :
$ cat test.c
#include <stdio.h>
int main() {
int a = 3;
int b = 3;
// aren't we supposed to add 2 and 2 ??/
a = 2;
b = 2;
printf("%d\n", a + b);
return 0;
}
$ gcc -W -Wall -trigraphs test2.c 2>/dev/null
$ ./a.out
5
$
- tbirdz 12y agoVery sneaky. For anyone else wondering why this works, look up trigraphs.
- vidarh 12y agoAnd after looking it up, you better then realise that if you actually ever use them in production code you better have a really good reason, or your colleagues will forever curse your name.. I think the above is probably the first time I've seen trigraphs used in the last 20 years or so.
- adito 12y agohttp://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C http://en.wikipedia.org/wiki/Digraphs_and_trigraphs#C sorry for spoiling: "??/" got replaced by "\"
- gizmo686 12y agoIs the trick here the "-trigraphs" flag, or the fact that you are showing us test.c but compiling test2.c? Both approaches seem like they should work.
- cdcarter 12y agoIt's the trigraph ??/ which translates to a \.