lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Apr 10, 2012 at 3:23 PM, liam mail <liam.list@googlemail.com> wrote:
> On 10 April 2012 22:50, Josh Haberman <jhaberman@gmail.com> wrote:
>> lua_newuserdata(L, 0);
>
> Is this valid? I just had a quick look at the online 5.2 source and
> this will create and object of size Udata yet lua_newuserdata will
> increment the pointer past the Udata and returns that pointer. Which
> from the looks of it is not a valid pointer.

My understanding is that ANSI C allow you to compute and represent a
pointer "one past the end" of an allocated region, but obviously
you're not allowed to dereference it.

> [1] this may not have anything todo with the error.

It doesn't; I get the same results if I use 1 instead of 0.