[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.0 beta/loadmodule question
- From: Eero Pajarre <epajarre@...>
- Date: Fri, 07 Mar 2003 21:56:40 +0200
Asko Kauppi wrote:
I would check data alignment settings. The luaL_openl() macro (which
you're not using) does "sizeof(tbl) / sizeof(tbl)" which only works
if there are no gaps between the table entries. For this reason, such
entries should be N*4 or N*8 bytes wide. I don't know if the authors
have considered this. So switch you compiler's data alignment to 2 or 4
bytes and see what happens.
I am pretty sure that sizeof(tbl)/sizeof(tbl) is a safe C/C++ idiom.
C/C++ arrays don't contain "gaps", if padding is needed it is already
inside the structs.
(Actually when using the idiom you have to be careful that tbl is an array,
things go wrong if it is a pointer, which of course otherwise works as an
array in C/C++)