今天在学习Glibc2.17中的API setjmp和longjmp查看了一下其源码:
Bsd-setjmp.c:
int setjmp (jmp_buf env)
{
return __sigsetjmp (env, 1);
}
Setjmp.h:
/* Calling environment, plus possibly a saved signal mask. */
struct __jmp_buf_tag
{
/* NOTE: The machine-dependent definitions of `__sigsetjmp'
assume that a `jmp_buf' begins with a `__jmp_buf' and that
`__mask_was_saved' follows it. Do not move these members
or add others before it. */
__jmp_buf __jmpbuf; /* Calling environment. */
int __mask_was_saved; /* Saved the signal mask? */
__sigset_t __saved_mask; /* Saved signal mask. */
};
typedef struct __jmp_buf_tag jmp_buf[1];
其中对 typedef struct __jmp_buf_tag jmp_buf[1]; 不是很理解。
仔细研究了下发现