Mail from god

Posted on Friday, November 21, 2008 by Anuj Mehta

Just came across an old mail from God aka Bjarne Stroustrup. I was ecstatic when I received a mail from him as I never expected a reply for such a naive query. Below is the mail



From: Bjarne Stroustrup [mailto:bs@cs.tamu.edu]
Sent: Saturday, August 18, 2007 7:12 AM
To: Anuj Mehta
Subject: Re: Deletion of a Pointer Twice

Bjarne Stroustrup wrote:
> From: "Anuj Mehta"
> To:
> Subject: Deletion of a Pointer Twice
> Date: Thu, 21 Jun 2007 09:17:06 +0530
>
>
> Hi
>
>
>
> In my project I am getting a runtime error which is due to deletion of a
> pointer twice.
>
> Code size of the project is really huge.
>
> Also the stack trace does not point towards a particular pointer so that I
> can make it NULL after deletion.
>
>
>
> I tried to put a try/catch but the control does not come to catch block. I
> had tried catch (std::exception & excep)
>
> Can u please suggest me a way through which I can solve this problem?
>

Don't delete a pointer twice.

I don't see any alternative to tracking down that bug. It is serious and
could easily be the indicator of some serious problems with resource
management. Try using a leak detector; sometimes they can catch double
deletions.



>
>
> Regards,
>
> Anuj Mehta
>
> "Nothing endures but change"

There is a way to be good again

Posted on Wednesday, November 19, 2008 by Anuj Mehta





Past 3 days were very emotional for me as

1. I was reading "Kite Runner" by Khalid Hosseini.
2. Yet another BAD appraisal.

I am used to such appraisal's hence I stopped worrying about. But I am still worrying about Hasan and Amir, on whom the "Kite Runner" is based. Phew what a book, it's one of those rare books that touches your soul and leaves a long lasting imprint on your mind. It's an emotional story of two friends (Amir and Hasan) based in Afghanistan, they grow up together and later due to some circumstances their lives takes different path. There is war on Afghanistan and Amir settles in America while Hasan stays in Afghanistan. During their childhood days Amir did some mistakes because of which Hasan suffers, but later he gets a way to be good again. Thus the central theme of this book "There is a way to be good again".


PS: Yesterday a friend of mine Rohit told me that he can't write comments on my blog as I blocked anonymous people for writing comments. I was really glad that some people are reading my blog. I will remove the restrictions and please do write your valuable comments.

Quotes on programmers

Posted on Monday, November 10, 2008 by Anuj Mehta

A good programmer is someone who always looks both ways before crossing a one-way street. ~Doug Linder

If debugging is the process of removing bugs, then programming must be the process of putting them in. ~Author Unknown

Everyone knows that debugging is twice as hard as writing a program in the first place. So if you are as clever as you can be when you write it, how will you ever debug it? ~Brian Kernighan

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. ~Martin Golding

Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ~Martin Fowler

Beta. Software undergoes beta testing shortly before it’s released. Beta is Latin for “still doesn’t work.” ~Author Unknown

Controlling complexity is the essence of computer programming. ~Brian Kernighan

Good code is its own best documentation. As you’re about to add a comment, ask yourself, “How can I improve the code so that this comment isn’t needed?” ~Steve McConnell

Programming is similar to a game of golf. The point is not getting the ball in the hole but how many strokes it takes. ~Harlan Mills

When debugging, novices insert corrective code; experts remove defective code. ~Richard Pattis

@Override

Posted on Thursday, November 06, 2008 by Anuj Mehta

A nice article by Peter on the very confusing topic of @Override annotation

@Override