Duff’s Device October 22, 2007
Posted by Ananth in General.5 comments
void foo() {
switch(0) {
case 0: do{
case 1: printf("Hello World\n");
}while(0);
}
}
int main()
{
foo();
return 0;
}
Surprise. Surprise. This program compiles and works due the fall-through definition of C ! Tom Duff discovered this accidentally (about 25 years ago) and said: “It amazes me that after 10 years of writing C there are still little corners that I haven’t explored fully.”Wow, Some discovery ! In a discrete system with finite states whose permutations can never be fully explored in a entire lifetime, it is a question of whether you hit a permutation that happens to be interesting ![]()
God is a Ferrari Fan October 21, 2007
Posted by Ananth in sports.3 comments
Kimi won the world championship. w00t !
Beautiful Code October 12, 2007
Posted by Ananth in Computer Science, Programming.2 comments
For the last two weeks, I’ve spent every ounce of my spare time trying to finish “Beautiful Code”. There will be two kinds of people: Those who think its a pointless piece of non-sense and Those who find the book a religious experience . Sharing as they did, some of their most intense experiences of programming and profound insights into the art, were legendary modern day programmers who stand tall to inspire us all: Brian Kerninghan, Karl Fogel, John Bentley, Charles Petzold, Greg Kroah-Hartman, Simon Peyton Jones and Bryan Cantrill.
The two best chapters in the book were: Beautiful Debugging & A Spoonful of Sewage.
I am ordering a hard copy so that I can pray to the book everyday