Last 5 Posts from 2008/May/20

One myth less

I do write C code on a daily basis since 2001 and I don't know why I always believed that free(NULL) would crash, so I always used the painful construction:

        if (p)
                free(p);

Until yesterday! While talking to Lennart Poettering and we bet about that. Damn, I was so sure about it, but I'd really want to believe I was wrong, since I could avoid such stupid "if". Well, after we got David Zeuthen's phone we checked the free(3) man page and I was proved wrong!

Thanks Lennart, I owe you some bucks ;-)