> I found that CALLBACK_PROLOGUE and CALLBACK_EPILOGUE
> makes most programs less, not more, stable.  The simple
> program below crashes when it calls FrmCloseAllForms.
> 
> It does not crash if I comment CALLBACK_PROLOGUE and
> CALLBACK_EPILOGUE.
> 
> Can somebody explain why?
> 
> Boolean MainFormHandleEvent(EventPtr event) {
> CALLBACK_PROLOGUE
>     switch (event->eType) {
>     case frmOpenEvent:  // after the form is opened, draw it
>         FrmDrawForm(FrmGetActiveForm());
>       return 1;
>     default: break;
>     }
>     return 0;
> CALLBACK_EPILOGUE
> }

  no bug.. just careless programming.. :) think about the steps
  in your code!

  ---
  {
    Boolean processed;
  
    CALLBACK_PROLOGUE

    .... 

    CALLBACK_EPILOGUE

    return processed;
  }
  ---

  you have TWO returns, both of which fail to execute the
  "EPILOGUE" - hence, it is NOT fixing the registers a4 and a5.

  hence = crash.

  the reason why it works without is simple.. you are not touching
  any global variables.. if you had a global, and used it.. it 
  would crash.

  :) good programming practive = 1 return in functions, that way,
  you can spot errors like this! :)

  cheers.

az
--
Aaron Ardiri 
Lecturer                       http://www.hig.se/~ardiri/
University-College i G�vle     mailto:[EMAIL PROTECTED]
SE 801 76 G�vle SWEDEN       
Tel: +46 26 64 87 38           Fax: +46 26 64 87 88
Mob: +46 70 352 8192           A/H: +46 26 10 16 11

Reply via email to