lua-users home
lua-l archive

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


> I also though of this, but the problem, as stated in the given article, is
> that arguments have various sizes. Chars are mapped to 4 bytes, so are ints
> of course, but floats and structures are bigger.

Or to be pedantic, not 4 bytes but (typically) a machine word. It's a
reasonable assumption that everything is padded up to a machine word; in
that case you can portably pass ints, longs, chars, floats and pointers (on
a 32-bit or bigger machine) and probably doubles on a 64-bit machine. Stick
to integral types up to sizeof(uintptr_t) and pointers (since floats may be
doubles) and you're probably safe on 90% of systems.

-- 
http://sc3d.org/rrt/ | art, n.  romanticized mundanity