News for hackers. Stuff that matters.
Re:Why Lisp is Awesome by chollida1 on Wednesday January 06, 2010 @06:20PM (#1036067)
I wasn't aware you could use const char pointers in switch statements.

switch (var) {

    case "foo":
        printf("foo block.");
        break;

    case "bar":
        printf("bar block.");
        break;

    default:
        printf("Default case")
}
Re:Why Lisp is Awesome by mbrubeck on Wednesday January 06, 2010 @07:21PM (#1036167)
You can't:

$ cat foo.c

    #include <stdio.h>
    main() {
        const char *foo = "bar";
        switch (foo) {
            case "foo":
                printf("foo\n");
        }
    }
$ gcc -pedantic -std=c99 foo.c -o foo

    foo.c: In function ‘main’:
    foo.c:4: error: switch quantity not an integer
    foo.c:5: error: case label does not reduce to an integer constant
Re:Why Lisp is Awesome by chollida1 on Thursday January 07, 2010 @11:46AM (#1037355)
Sorry to make you put in so much work.

I'm aware that you can't do this.

I guess my sarcasm didn't translate:)