[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_getn segfault
- From: Tuomo Valkonen <tuomov@...>
- Date: Tue, 29 Jul 2003 20:59:37 +0300
On Tue, Jul 29, 2003 at 02:20:04PM -0300, Luiz Henrique de Figueiredo wrote:
> On the other hand, when you
> program in C, then you're on your own, as usual (try sending NULL to one of
> the string or file functions in the C standard library).
Sure it's up to the programmer to make sure e.g. NULL lua_State is not
passed to the API but after that it should be up the the API to make
sure stuff in the stack is ok. Writing to a file on a full file system
does not crash programs in fwrite().
> Which users do you mean? Do you have users that program in C? If so, do you
> really want to hold their hand?
My program is free software and I only provide the sources. (Other
people handle making binary packages for random OSes). It should be
as easy as possible for the users to install it from the sources as
well and _patching Lua_ certainly is not something users should have
to do.
So now I'll just have to write inefficient lua_*_check { luaL_checktype;
lua_* } wrappers to random functions (which? it's not documented anywhere,
is it? e.g. lua_settable seems not to crash...) although it would be only
a few instructions in the Lua code itself to do the checks. Since the
code to do the checks already is there, then _why_ can't the checks be
enabled by default? Those who need the few instructions' speed improvement
probably have the resources to use a modified version of Lua (and probably
even do so already), while the rest of us would have a lot easier time
writing our C code with api_check throwing a usual lua_error.
--
Tuomo