Evan Martin (evan) wrote in evan_tech,
Evan Martin


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...)
Tags: icfp

  • blog moved

    As described elsewhere, I've quit LiveJournal. If you're interested in my continuing posts, you should look at one of these (each contains feed…

  • dremel

    They published a paper on Dremel, my favorite previously-unpublished tool from the Google toolchest. Greg Linden discusses it: "[...] it is capable…

  • treemaps

    I finally wrote up my recent adventures in treemapping, complete with nifty clickable visualizations.

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.