Author Topic: CB svn rev 2338 !sanitychecked  (Read 6497 times)

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
CB svn rev 2338 !sanitychecked
« on: April 12, 2006, 05:39:27 pm »
thanks for removing all sanitychecks,
now the crash on exit is back  8)
when running under linux ...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: CB svn rev 2338 !sanitychecked
« Reply #1 on: April 12, 2006, 06:21:14 pm »
You're welcome :)

Besides, I just found that it crashes under Windows, too, if you have a source file open, but no project. :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: CB svn rev 2338 !sanitychecked
« Reply #2 on: April 12, 2006, 06:38:06 pm »
Besides, I just found that it crashes under Windows, too, if you have a source file open, but no project. :)
And this one is fixed.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: CB svn rev 2338 !sanitychecked
« Reply #3 on: April 12, 2006, 08:42:50 pm »
 :shock:!!!!

What? You removed all the sanity checks!? :( Oh man - Do you realize that many functions assume that the sanity checks are there? And no, I don't remember them... now I got scared.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: CB svn rev 2338 !sanitychecked
« Reply #4 on: April 12, 2006, 09:17:20 pm »
Sanity check does a null pointer check and keeps a copy of this as a member variable.
The purpose of the null pointer check is quite clear, but I tried to find out what a local copy of this could be good for this morning.
After experimenting for two hours (allocating, freeing, changing pointers, deriving classes, overwriting pointers), I found no real case in which having a copy of this as a member would be an advantage. It does catch overwriting a previously correctly assigned pointer (why on earth would anyone do that?), but it does not catch an uninitialised pointer or anything else.

Thus, since I was unable to figure what all this magic was good for (except a null pointer check), I asked Yiannis whether he knew. Yiannis said we actually did not need sanity checks any more, since they were remnants of old times.

I wondered whether it was generally a good idea to "hide" a programming error (such as a null pointer) rather than address the root of the problem. Yiannis agreed on that and said we should rather accept a crash, look at the backtrace, and then fix the error, instead of brushing the problem under the carpet.
He then suggested I should feel free to remove the sanity checks alltogether, and I was happy to do so.

So far, the results don't look too desasterous. Tiwag is witnessing the son of crash on close under Linux, and I have seen a crash on close under Windows if editors are open without a project (this no longer persists).
On the positive side, we now have quite noticeable reduction in code size :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: CB svn rev 2338 !sanitychecked
« Reply #5 on: April 13, 2006, 06:13:36 am »
OK then! I'll trust you guys in this.

P.S. How long till all bugs get fixed? I'm anxious to test RC3  :wink:

Oh, yeah, I forgot. The reason for the sanity checks was the infamous wxApp::Yield(). IIRC, there was a part of the code that needed a rewriting to get rid of this and still be responsive. Was it the compiler?  :|  I can't remember...
« Last Edit: April 13, 2006, 06:15:54 am by rickg22 »