Listing 1 An example of using negative frame addressing via the declare_error function in Borland C++ to find a return address

  static void near error_return(void)
  {
    longjmp(error::current->jmpbuf, 1);
  }

  void declare_error(void)
  {
    _AX = (int) error_return;
    asm MOV BP,[BP];  // move frame pointer up one level
    asm MOV [BP+2],AX;  // patch return address
    #if defined(__MEDIUM__) || defined(__LARGE__) || defined(__HUGE__)
      asm MOV [BP+4],CS; // if return address is far, patch segment, too
    #endif
  }

  error error_x;
  if (setjmp(error_x.jmpbuf))
  {
    <garbage collection>
    declare_error();
    return;
  }
/* End of File */