Home > Computer Programming, Computer Science > C Traps and Pitfalls !

C Traps and Pitfalls !

I still believe that C was/is my oldest and first love :). And when I read this paper C Traps and Pitfalls By: Andrew Koenig of AT&T Bell Laboratories, this love was even consolidated ;). Specially the function call (*(void(*)())0)(); really made me believe that, “C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do, it blows your whole leg”.

For the curious readers the hint is enough that this is the function call to a function whose address is stored at 0(zero) location, rest of the details can be read in the beautiful article that I mentioned earlier.

Advertisements
  1. December 12, 2006 at 12:59 pm

    a slight correction. I think:

    call (*(void(*)())0)();

    is not function call to a function whose address is stored at 0(zero) location, instead it is function call to a function that is itself stored at 0(zero) memory address.

    Good article bye the way…:)

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: