Ilya Zakharevich on Thu, 16 Jan 2003 13:17:20 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Warning with OSF/1 cc


On Thu, Jan 16, 2003 at 10:10:43PM +0100, Bill Allombert wrote:
> Now the problem is that g++ reject longjmp(e, numerr); and gcc reject
> longjmp((jmp_buf) e, numerr) so making code that work with both is
> difficult.

Unrelated thing: it does not make sense to longjmp() with numerr; one needs to longjmp() with HAVE_ERROR (which is, e.g., 1) after storing

 saved_numerr = numerr;

This is from docs of setjmp() I have:

    setjmp() may be implemented as macro.  setjmp() can be used only
    in the following contexts:

    - the entire controlling expression of a do, if, switch, or while
      statement

    - the operand to the ! operator if the resulting expression is the
      entire controlling expression of one of the statements listed
      above

    - the operand of a relational or equality operator if the
      resulting expression is the entire controlling expression of one
      of the statements listed above and the other operand is an
      integral constant expression

    - the entire expression of an expression statement.

As you see, there is no way to get the value of numerr from setjmp()
[unless we have a switch with one clause per error].

BTW, I fixed the problem of numerr able of being 0 in my copy; I will
send a patch some time soon.

Ilya