[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_pushlightuserdata fed with NULL pointer
- From: Duboucher Thomas <thomas@...>
- Date: Sun, 24 Oct 2010 20:31:37 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Le 24/10/2010 14:34, Peter Cawley a écrit :
> On Sun, Oct 24, 2010 at 1:27 PM, Shmuel Zeigerman <shmuz@013net.net> wrote:
>> 1. lua_pushstring(L, NULL) is equivalent to lua_pushnil(L).
>> 2. lua_pushlightuserdata(L, NULL) pushes light userdata with null value.
>>
>> I would suggest (for Lua 5.2) making case 2 above to behave as case 1, since
>> there is no (easy) way to find out from Lua script if it was the null
>> pointer.
>
> I am not a fan of the proposed behaviour. NULL as a char* generally
> means "no string", the nearest representation of which is nil. NULL as
> a void* has a wider meaning, and already has a representation as a
> light-userdata with no loss of information.
>
>
I do agree; a char* equals to a NULL pointer is an invalid string,
hence pushing a nil is correct behaviour; a NULL userdata is a userdata
that has not been yet or properly inititialized and pushing it is also a
correct behaviour since it hold informations about its incorrect
initilization.
- --
Thomas.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkzEe4kACgkQBV7eXqefhqieSACgn7lW3AmnBsAdsaDl48f8MVxP
6FsAnRo+2jKVhOJ8jxX3caM98k3nE+im
=Q92Y
-----END PGP SIGNATURE-----