[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: want luaL_verror()
- From: Iain Hibbert <plunky@...>
- Date: Tue, 27 Nov 2012 23:35:52 +0000 (GMT)
On Tue, 27 Nov 2012, Roberto Ierusalimschy wrote:
> > That is correct, but because luaL_error() does not actually return, the
> > calling function of luaL_verror() will never be returned to, and thus the
> > va_end() that is there will never be called..
>
> Who calls va_start and its corresponding va_end is lua_pushvfstring
> (actually luaO_pushfstring, an internal function), which usually
> returns. The error is raised after the call to va_end. Nobody else
> needs to call either va_start or va_end.
yes they do, because lua0_pushfstring() is not in the call path here. your
example was
LUA_API int luaL_verror (lua_State *L, const char *fmt, va_list argp) {
return luaL_error(L, "%s", lua_pushvfstring(L, fmt, argp));
}
so any caller of luaL_verror() would need to provide a valid va_list, and
the only way to get this is to use va_start() before the luaL_verror()
call and va_end() after.. but you cannot do that, since that code will not
be reached.
regards,
iain
- References:
- want luaL_verror(), John Belmonte
- Re: want luaL_verror(), Roberto Ierusalimschy
- Re: want luaL_verror(), John Belmonte
- Re: want luaL_verror(), Roberto Ierusalimschy
- Re: want luaL_verror(), Coda Highland
- Re: want luaL_verror(), Roberto Ierusalimschy
- RE: want luaL_verror(), Richter, Jörg
- RE: want luaL_verror(), Richter, Jörg
- Re: want luaL_verror(), Roberto Ierusalimschy
- Re: want luaL_verror(), Iain Hibbert
- Re: want luaL_verror(), Roberto Ierusalimschy