lua-users home
lua-l archive

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


Roberto,

what about making backwards compatible change in the future API releases? Given that responsible API user will need to check the pointer for NULL anyway (at least in the case above), maybe it would be reasonable to embed this check in the API and push synthetic empty string in case len is zero and the pointer is NULL. Either it will be done inside the API or each and every developer will be forced to write additional wrappers on top of pushlstring (or write unreliable code)...

This change does not seem to break anything. Just adding this point to the documentation will force people to, well, read documentation in some buggy situations like this.

On Mon, Aug 24, 2015 at 9:13 PM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> > 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.

Sure (given that even I got confused :-).

-- Roberto




--
Best regards,
Igor A. Ehrlich