lua-users home
lua-l archive

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

Roberto Ierusalimschy wrote:
> > And you don't need an extra table for uppercasing.
> > [...]
> > #define lj_ctype_toupper(c)     ((c) - (lj_ctype_islower(c) >> 1))
> > #define lj_ctype_tolower(c)     ((c) + lj_ctype_isupper(c))
> I thought about that, but it uses 'c' twice. (Yes, I know this is not
> a problem in particular points in the lexer, but it is strange anyway.)

Sure, multiple uses of arguments in C macros are an accident
waiting to happen. But declaring functions as inline is not an
option for the C89 Lua code base. So add a warning in the comments
and be done. The current lobject.h isn't particularly clean in
this regard, either (e.g. l_isfalse() or hvalue() etc. with
asserts enabled)