3

I'm thinking of using CrashRpt open-source library but I'm worried about performance. The app performance requirement is critical so it's very importing not to slow it down. The author affirms that there's no performance degradation but I would like to hear some other people opinions.

I was checking the demos of this library and in the case of MFC app, you just need to load the DLL on the main project and override CWinApp::Run()

The way it does it is like this:

int CMFCDemoApp::Run() 
{
  // Install crash reporting...

  BOOL bRun = TRUE;
  BOOL bExit=FALSE;
  while(!bExit)
  {
    bRun= CWinApp::Run();
    bExit=TRUE;
  }

  // Uninstall crash reporting...

  return bRun;
} 

You can check all the demo code on this link: https://sourceforge.net/p/crashrpt/code/ci/master/tree/demos/MFCDemo/MFCDemo.cpp

I have never overriden CWinApp::Run(), so I don't know if that while() loop will affect in some way.

Thanks in advance for your opinions.

manujcm
  • 163
  • 11
  • 1
    `CWinApp::Run()` is the main message loop, it should be called once. That code is not doing anything. It just calls `CWinApp::Run()` as it is supposed to, then it breaks the loop immediately. I wouldn't trust the code if it has strange stuff like that. – Barmak Shemirani Mar 11 '16 at 02:41
  • @BarmakShemirani Thank you for your explanation. I don't understand the purpose of the while loop. But in the official documentation, they recommend to use that snippet. http://crashrpt.sourceforge.net/docs/html/enabling_crash_reporting.html – manujcm Mar 11 '16 at 02:46
  • 1
    It's technically not wrong. But it's something a beginner programmer would write. You can overload `int CMFCDemoApp::Run()` in that way, and return `bRun`. But the extra `while` loop is pointless and confusing. – Barmak Shemirani Mar 11 '16 at 03:06
  • I see, then I will comment out that loop and and just return bRun. Thanks! Then with respect to this part it should not affect to performance at all. I assume that the other parts won't affect since they're called only when the exception is raised. – manujcm Mar 11 '16 at 03:42
  • 1
    Crash Rpt won't have the slightest impact on the performance of your program because it will only do something when an exception occurs – Jabberwocky Mar 11 '16 at 07:25
  • @MichaelWalz Thank you for your answer. About the strange while() loop do you think it has any purpose or do you agree with Barmak? I wonder why they put that on the official documentation. – manujcm Mar 11 '16 at 07:35
  • 1
    @manujcm yes I agree with Barmak, I don't really understand the purpose of that loop either. – Jabberwocky Mar 11 '16 at 07:48
  • 1
    @MichaelWalz Thank you again. I think the comment "Crash Rpt won't have the slightest impact on the performance of your program because it will only do something when an exception occurs" should be the answer. – manujcm Mar 11 '16 at 08:06

0 Answers0