[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Acceptable indicies
- From: liam mail <liam.list@...>
- Date: Wed, 31 Aug 2011 15:01:50 +0100
On 31 August 2011 14:56, liam mail <liam.list@googlemail.com> wrote:
> On 31 August 2011 14:21, Luiz Henrique de Figueiredo
> <lhf@tecgraf.puc-rio.br> wrote:
>>> But how do you validate, say, an index you give to a C function that
>>> queries the Lua stack?
>>
>> Use lua_type. The manual says that it returns LUA_TNONE for a non-valid index.
>>
>>
> Only a non valid acceptable index, a non valid non acceptable index is
> undefined and there is no way to determine if an index is non valid
> non acceptable.
>
> Liam
>
What I should really say is an non acceptable index which is greater
than the stackspace plus extra space plus 1 (end of an array can be
used to compare an index inside the array) is undefined, this is due
to index2adr if I understand correctly. For example using index 30
when stackspace is 20 and extraspace is 5* then the following is UB in
C.
if (o >= L->top)
* numbers pulled out of the air.
- References:
- Acceptable indicies, liam mail
- Re: Acceptable indicies, oliver
- Re: Acceptable indicies, Robert Raschke
- Re: Acceptable indicies, Robert Raschke
- Re: Acceptable indicies, oliver
- Re: Acceptable indicies, Robert Raschke
- Re: Acceptable indicies, oliver
- Re: Acceptable indicies, Josh Simmons
- Re: Acceptable indicies, oliver
- Re: Acceptable indicies, Luiz Henrique de Figueiredo
- Re: Acceptable indicies, liam mail