Tuesday, September 23, 2008

small annoying bugs :-(

Sometimes when you debug a code, You don't espect a bug in project settings and spand a lot of time to correct program

some suggestion that may help with it. All this is very important and actual for mobile development

1. All resources line memory allocation, files, etc., you need to put in a wrapper
for example

2. All unexpected behavior line "low memory" should raise exception and exit

class MyDataBlock
   MyDataBlock():mData(int size)
      ASSERT(size>0,"wrong size");
      mData = new char[size];
      ASSERT(mData,"low memory");

      delete[] mData;

3. Logs

About logs I have two things :
  • developers logs - you ,ust have it when there is no debug mode. For example when you create driver or something very specific and all that you can is to print a message to file or to screen
  • log stack. When application crashes it is very useful to have functions call stack. It gives you information about case when error (crash bug) happened