[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.4.0 (rc3) now available
- From: Hugo Musso Gualandi <hgualandi@...>
- Date: Wed, 13 May 2020 10:22:56 -0300
> #define sizelstring(l) (offsetof(TString, bytes) + ((l) + 1) *
> sizeof(char))
Is it OK if sizelstring(l) sometimes is less than sizeof(TString)?
> 'offsetof' would be better.
I checked here and GCC 10 does not emit warnings if we use offsetof
instead of sizeof.
> And gcc allows 'char bytes[0];' or 'char bytes[];' .
In this particular case the array size always needs to be at least one
because of the null terminator. That said, a zero-length array would
have avoided creating the extra padding.
-- Hugo
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org