N
Noob
Hello,
The spec for longjmp states:
After longjmp is completed, program execution continues as if the
corresponding invocation of the setjmp macro had just returned the
value specified by val. The longjmp function cannot cause the setjmp
macro to return the value 0; if val is 0, the setjmp macro returns the
value 1.
This means longjmp has to do something along the lines of
return (val != 0) ? val : 1;
Another possibility would have been to specify that calling longjmp
with a value of 0 had undefined behavior.
Does anyone know why the ANSI chose to make a special case
for longjmp(env, 0) ??
Was it because most implementations circa 1988 worked that way?
Regards.
The spec for longjmp states:
After longjmp is completed, program execution continues as if the
corresponding invocation of the setjmp macro had just returned the
value specified by val. The longjmp function cannot cause the setjmp
macro to return the value 0; if val is 0, the setjmp macro returns the
value 1.
This means longjmp has to do something along the lines of
return (val != 0) ? val : 1;
Another possibility would have been to specify that calling longjmp
with a value of 0 had undefined behavior.
Does anyone know why the ANSI chose to make a special case
for longjmp(env, 0) ??
Was it because most implementations circa 1988 worked that way?
Regards.