lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I do not have access to the standards at this precise moment (will reply with section numbers at a later time). C99 specifies that it is fine to pass zero to memcpy as the size parameter. As for malloc, it is undefined for C99, C++ differs as it did define it.

On 23 August 2015 19:47:02 GMT+01:00, Sean Conner <sean@conman.org> wrote:
>
>It was thus said that the Great Roberto Ierusalimschy once stated:
>> > Yes I followed the code through as well, but I’m not happy with
>> > basing usage on what the code happens to do when the spec is silent
>> > about it.
>>
>> 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.
>
>  So, what should malloc(0) return?
>
>  -spc (There are two schools of thought here ... )

- --
Liam
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQJABAEBCgAqBQJV2lEXIxxMaWFtIERldmluZSA8bGlhbWRldmluZUBvb2x1YS5v
cmc+AAoJEMHN2ndQ8eFAlegP/1x9sgFe2mhNgKerNgrLBhX/I61AeImSemNzhdj8
Na6XVXhCNi1Lw2OlLmpgf/v/fyP39+viYnsMlTUY+HRoz7SdUfn1P+rCkddKs1Ik
k49jMJ5djOWl+neKxEaAx6kzbri/2O6cr2rah9z6tZBBhrnfpd/dy3Q+OIjBWXXi
t+5YMhx/YYV1z7zp6Dhi+/tOClQcShFcbzi/IEEbM8Uq6ALgwDd3CU2HehB57jBK
QWu2mlCzurpro/lZnj61lANg951mQfpWbVEXhkrmEhm2xYPAZEM05XsfRCCl56+P
m4O7Uh22MvBhXPJI3KU3286c+wWXxgvtyabdEQMNFFx0mTVMWFStOazvPLrGPIDv
5kAvEfHo90ykhmamAHsghj3p8iMMmU8vUygJ1N0OMm78vzwWCSlxWWCpcYhPiBVl
EXEHlGa6CNSY3Z1fgODJc2W0A/nJYYnbGWIltVqUq5mAOj9FYmWBAxOeiEuSXDq9
7qRiL+MtJxP57DgMWugWR3PpyrvTjUDOXRzsvpPY3KMDGmobzo2Q3HzUMb4e3YHE
xxmcIyokTZULzuM/93daOKKUvKStK3gi4QHo/BXXxmLrAhfvSWevZe8AA0zIiOm7
8GOXujdwzhG34GvwEJIKvfn1TRiNgAKvTNM9AaN8JGHcpZR1/JuLGdQR91iiMOhe
8vsr
=QdRx
-----END PGP SIGNATURE-----