C's handling of 'if' leads to a lot of room for obfuscation. All you have to do is replace ';' with '|' for compound expressions and add parentheses as neccessary. if (x) y; else z; becomes ((x)&&(y)) ||(z);
for compounds, if (x) y;z;a;b; else c;d;e;f; becomes ((x) && ((y)|(z)|(a)|(b)) ||((c)|(d)|(e)|(f));
C is so much fun to obfuscate. Gotta love ISO 9899. The result is still more readable than perl, though.
> C's handling of 'if' leads to a lot of room for obfuscation. All you > have to do is replace ';' with '|' for compound expressions and add > parentheses as neccessary. > if (x) > y; > else > z; > becomes > ((x)&&(y)) > ||(z);
> for compounds, > if (x) > y;z;a;b; > else > c;d;e;f; > becomes > ((x) && ((y)|(z)|(a)|(b)) > ||((c)|(d)|(e)|(f));
Andrey Vul wrote: > C's handling of 'if' leads to a lot of room for obfuscation. All you > have to do is replace ';' with '|' for compound expressions and add > parentheses as neccessary. > if (x) > y; > else > z; > becomes > ((x)&&(y)) > ||(z);
I tried your suggestion, with `exit(0)' for `z', and my compiler complained. Should I sue the vendor?
> for compounds, > if (x) > y;z;a;b; > else > c;d;e;f;
Beej Jorgensen <b...@beej.us> wrote: > Eric Sosman <esos...@ieee-dot-org.invalid> wrote: > > I tried your suggestion, with `exit(0)' for `z', and > >my compiler complained. Should I sue the vendor?
Andrey Vul wrote: > C's handling of 'if' leads to a lot of room for obfuscation. All you > have to do is replace ';' with '|' for compound expressions and add > parentheses as neccessary.
I see no love in that. "plonk" for false advertising.
Andrey Vul <andrey....@gmail.com> writes: > C's handling of 'if' leads to a lot of room for obfuscation. All you > have to do is replace ';' with '|' for compound expressions and add > parentheses as neccessary. > for compounds, > if (x) > y;z;a;b; > else > c;d;e;f; > becomes > ((x) && ((y)|(z)|(a)|(b)) > ||((c)|(d)|(e)|(f));
Codswallop. You clearly have avoided learning anything about order of evaluation. Which, given that it's one of the most commonly discussed things on c.l.c, is either terribly sloppy, or deliberate. Neither being commendable.
> C is so much fun to obfuscate. Gotta love ISO 9899. > The result is still more readable than perl, though.
Almost any language can be made practically un readable. Some just make it trivial, or even natural.
Phil -- Any true emperor never needs to wear clothes. -- Devany on r.a.s.f1