Leave a comment

momentsmusicaux October 24 2015, 12:37:54 UTC
Hmm you don't need mimic. Just other developers who change the line endings or change indentation to tabs is enough to annoy me :)

Reply

simont October 24 2015, 15:14:56 UTC
I've always fondly imagined that one of these days I'd find the right occasion to sneak #define do into the top of someone's C program. (Or perhaps into the Makefile: CFLAGS+=-Ddo hidden somewhere obscure.)

The effect would be to turn every do-while loop into an executed-once bare block (or single statement) followed by an entirely separate bodyless while loop. And it doesn't rely on any high-tech Unicode wizardry, which I think makes it a more elegant prank :-)

(Though it doesn't quite cover all possibilities. Code of the form
if (condition1)
do { /* stuff */ } while (condition2);
else
/* stuff */;becomes a syntax error under this transformation - now the if statement terminates at the closing brace of the do-block, orphaning the else clause. So a developer on guard against this prank might make a point of including a construction like this in their application as a defence!)

Reply

skington October 24 2015, 15:50:11 UTC
Surely you'd merely revert to the previous commit, or otherwise bisect your way from a known good point until you found the error?

Reply

simont October 24 2015, 15:54:48 UTC
Well, yes, of course any source-code prank along these lines (whether my C-specific thing or the Unicode mimicry technique or whatever else anyone might invent) are tricky to hide in the presence of version control.

So perhaps the person to deploy them against is someone who's neglected to use version control!

(But it would be mean to do it to a total novice, of course. Someone who isn't using version control but should know better.)

Reply

andrewducker October 24 2015, 15:55:31 UTC
I know a few people like that, if I was less pleasant :-)

Reply


Leave a comment

Up