evan_tech

Previous Entry Share Next Entry
02:33 pm, 21 Jul 07

icfp!

This weekend I've been working on the ICFP contest again.
I'm taking much more casually than last year -- I started after dinner last night and gave it just a few hours -- but the fun is not in being a strong competitor but in solving the problems.

I lost a good four hours today tracking down a C++ precedence bug. I needed to test whether a number was even and wrote
if (i & 1 == 0)
which unfortunately parses as
if (i & (1 == 0))
which is true for all nonzero i always false.

The worst part of it is, they provided a check program that told me nearly exactly where the problem was, but I looked over that code and convinced myself it was so obviously correct that a bug elsewhere must be cascading into the failure here.

That's what I get for being too clever, I guess! Shoulda just used mod in the first place.
(I'm also a little bummed that speed concerns have kept me from using any languages other than C++, though really we should've gotten to this point midday yesterday...)