[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Correct way to push an empty string?
- From: Tim Hill <drtimhill@...>
- Date: Mon, 24 Aug 2015 10:53:24 -0700
> On Aug 24, 2015, at 6:25 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>
>>> Maybe it is just me, but it seems that it goes without saying (both for
>>> memcpy and for luaL_pushlstring and anything similar) that if you use
>>> zero bytes in address 'a', 'a' should be irrelevant.
>>>
>>> -- Roberto
>>>
>>
>> Yes I agree, but having been bitten a few times in the past (a “memcpy” that crashed with NULL pointers even if size was zero) I was seeking confirmation. Thanks.
>
> Well, I stand corrected. According to ISO, 'memcpy' (and, therefore,
> luaL_pushlstring) cannot be called with NULL.
>
> -- Roberto
>
Is it worth updating the docs to make this clear? Especially as the other posts here (and some of the links) appear to indicate some confusion about this.
—Tim