[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: correctness of using longjump
- From: Antero Vipunen <antero@...>
- Date: Fri, 1 Oct 2004 06:18:33 +0700
Hi!
Is the using of longjump always correct?
For example consider the following samples:
int testi(int i) {
return !i;
}
int error(lua_State *L) {
lua_pushstring(L, "some error");
lua_error(L);
}
int some_func1(lua_State *L) {
int i;
int j = error(L);
int k;
// some other code here
}
int some_func2(lua_State *L) {
int i;
int j;
int k;
j = error(L);
// some other code here
}
int some_func2(lua_State *L) {
int i;
int j;
int k;
testi(error(L));
// some other code here
}
int some_func2(lua_State *L) {
int i;
int j;
int k;
return testi(error(L));
}
Is it correct? Can this code somehow corrupt the stack?
--
Antero Vipunen