Programming Assignment 1 Errata

Post date: Oct 7, 2009 11:56:45 PM

Some notes about programming assignment 1.

    • dlc in the datalab-handout.tar is distributed as a Linux x86 binary executable. There is no source. If you work on Mac OS X or on Windows (requires Cygwin), download the dlc.macosx or dlc.zip (contains dlc.exe) from the attachments below.
    • If you do your datalab on a 64-bit machine, you might have problem with tmax() test that says the result should be -1 (0xffffffff) which is incorrect. You have two options.
        • Use this make command: make CFLAGS=-m32
        • This tells gcc to compile in 32-bit mode instead of the default 64-bit mode. If you get compilation error involving gnu/stub-32.h, you will have to install additional development packages for the 32-bit environment, e.g. on Ubuntu it's called libc6-dev-i386.
        • Change LONG_MAX to INT_MAX in tests.c. The grader will use his own copy of tests.c, but he will compile the code on csa2, which is 32-bit Linux.
    • The reason is that LONG_MAX on 64-bit machine is 0x7fffffffffffffff and not 0x7fffffff, and LONG_MAX gets truncated when returned as int.
    • If you try to run dlc on bits.c, it might choke on some header files included by limits.h on your system. There should be no need to use limits.h, so you may remove the line that says #include <limits.h>.